Method and system for accessing operating system resources

ABSTRACT

An operating system includes APIs developed in part to support recent innovations in computer hardware and in part to provide enhanced services to application programs. Among their other features, these APIs provide access to operating system functionality in a manner that is comprehensive, efficient, usable, extendible and, in some cases, reusable.

CROSS-REFERENCE TO PRIOR APPLICATIONS

This application is a continuation of U.S. patent application Ser. No.08/354,491, filed Dec. 13, 1994, entitled “Method and System forAccessing Operating System Resources,” by inventors Chee Heng Chew etal., which application is hereby incorporated herein by reference.

FIELD

The field relates to computer software development, and moreparticularly relates to application program interfaces (APIs) thatfacilitate use of operating system resources by application programs andcomputer hardware.

BACKGROUND AND SUMMARY

The field of software development has undergone substantial evolution inthe 50 years since its inception. An early form of software simplyabstracted and represented hardware functions in a “human readable” formknown as assembly language code. Special purpose application programscould then be written in such code to command the computer to perform anorganized set of operations.

Assembly language coding has several drawbacks. One is that the coderequired to carry out a particular function has to be specificallyincluded in each program needing that function: dozens of softwaredevelopers might write code (or at least copy code) for a singlefunction dozens of times for dozens of programs. A second drawback toassembly language coding is that programmers must understand thecomputer's internal hardware resources: as hardware is changed, so mustthe programmers' software programs.

To address these and other difficulties, the software necessary tooperate a computer was soon split into two classes: operating systemsoftware, and applications software.

Operating system software (sometimes termed simply “the operatingsystem”) is a set of computer code that performs a variety of functions,including interacting with the computer hardware; insulating theprogrammer from the specifics of the computer hardware; and providinggeneral functionality (“resources”) that many application programsrequire.

Applications software (sometimes terms “applications”), in contrast,addresses a particular problem to be solved. Examples of applicationssoftware are word processors and accounting programs. Applicationssoftware and operating systems communicate using a series ofstandardized instruction codes passed between the two. The operatingsystem software interprets these standardized instruction codes, andcontrols the computer's hardware resources in response thereto.Oftentimes, information in the form of data or messages is passed backto the applications software. In this manner, the operating systemsoftware—once written—effects most direct control of the hardware,allowing the application software programmer to focus on the particularproblem sought to be solved. (Alternatively, application software canstill include assembly language code—directly controlling the computerhardware and bypassing the operating system. This may be done for speedor control, or simply to provide functionality not supported by theoperating system.)

The relationship between operating system software, applicationssoftware and hardware is not always clearly defined. Over the lastseveral decades, each has evolved rapidly. As was noted above, operatingsystems sometimes evolve to include functions common to severalapplications. Similarly, operating systems are sometimes modified toinclude functionality previously provided only in hardware andvisa-versa. For example, data compression can be done in software (by anoperating system or application) and in hardware (by a specializedchip). Essentially, the three technologies have developed together inresponse to user demand and advances in technology.

A specific factor driving the evolution of operating system software hasbeen the desire to simplify and speed application software development.Application software development can be a daunting task, sometimesrequiring hundreds of man-years of effort for a sophisticated program.For a popular operating system such as Microsoft® Windows™, applicationssoftware developers may write thousands of different applications eachyear to execute on the Windows operating system. The investment inapplication development time is large. One incentive to create suchprograms is to provide good support for the application software throughthe operating system. This requires building a coherent and usable basefor applications developers to work with.

Often, development of application software can be made simpler by makingthe operating system more complex. That is (as noted above), if afunction may be useful to several different application programs, it isbetter to write it once for inclusion in the operating system, thanrequiring dozens of software developers to write it dozens of times forinclusion in dozens of different applications. In this manner, if theoperating system supports a wide range of common functionality requiredby a number of applications, significant savings in applicationssoftware development costs and time can be achieved.

Another factor driving the continuing evolution of operating systemsoftware is the ongoing development of faster and more sophisticatedcomputer hardware—both in the computer's central processing unit (CPU)and in its peripheral devices (e.g. printers). New CPUs typically offerenhanced instruction sets that enable certain new operations to beperformed, or enable old operations to be performed more quickly.Corresponding enhancements are usually made to the operating system toafford applications access to these new CPU capabilities.

The relationship between operating systems and hardware has also driventhe development of a special class of software: device drivers.Peripheral devices usually do not communicate directly with theoperating system. Instead, such devices usually communicate with devicedriver software, which in turn communicate with the operating system. Adevice driver thus serves as a software interface between operatingsystem software and peripheral device hardware. The specificrequirements of a particular hardware device are often handled by thedevice driver, making the details transparent to the operating system. Acomputer system typically employs many different device drivers, e.g.one for the display, one for the printer, one for the mouse, etc.

Often, a new peripheral device can be supported just by writing a newdevice driver tailored to exploit its hardware; no revision to theoperating system is required as long as the operating system recognizesand can communicate with the device driver. Sometimes, however,significant gains in functionality and efficiency can be achieved byupgrading an operating system's facilities for interacting with devicedrivers (and thus with the peripheral hardware).

It is clear that for a useful and accomplished operating system, theinterfaces between the operating system and the computer hardware andapplication software are as important as efficient internal operation ofthe operating system itself.

The present invention is directed to improvements in computer operatingsystems. In particular, the invention concerns certain ApplicationsProgram Interfaces (APIs). APIs are mechanisms by which applicationssoftware can request services from the operating system, includingcertain hardware operations and access to various operating systemresources. APIs also serve as the means by which messages andinformation provided by the operating system is relayed back to theapplications software for its use. (Device drivers sometimes make use ofoperating system APIs as well. For expository convenience, the presentspecification refers to software that makes use of APIs simply as“applications software” —it being understood that this usage encompassesdevice drivers as well.)

The evolution of APIs tracks that of computers generally. The firstoperating systems provided only limited collections of APIs, which wereactually more in the nature of user (operator) interfaces (e.g. PrintScreen) than application interfaces. As the functionality provided bycomputers via operating systems increased, so did the number of APIsavailable to access this increased functionality.

Generally, operating systems are developed for use with a specific(CPU). Thereafter, the operating system can be used on any computer thatuses that or a compatible CPU, regardless of which manufacturer producedthe computer, or minor idiosyncrasies in its design.

Likewise, application programs are generally developed for use with aspecific operating system. To the extent that two operating systemssupport the same API sets, an application program is “portable” and canbe executed on either system.

Contemporary operating systems are provided with rich sets ofAPIs—sometimes numbering in the hundreds of operating system calls andresponsive messages—greatly facilitating the task of the applicationsoftware development.

When implementing an API set for a new operating system or function, thestraightforward approach is to write an API for each operating systemfunction or resource that may be required by an application program orhardware device. More commonly, however, operating system APIs aredeveloped in the process of enhancing an existing operating system. Inthis context, the straightforward approach is to take the predecessoroperating system's API set and make use of those APIs whenever possiblein the new operating system. The prior APIs can be patched or extended,where necessary, to take advantage of—for example—new hardwarecapabilities.

The foregoing design philosophies may be characterized largely as rote:i.e. following old ways, with old calls, old formats, and oldparameters. Technically superior operating systems distinguishthemselves by inventiveness beyond the rote. Invention in the interfacecan manifest itself in many ways: breaking out of the comfort of the oldin favor of a new or unfamiliar approach; devising new operating systemfunctions from the feature set of old CPU hardware; making existingoperating system functions available in a more meaningful or efficientmanner (with the same hardware); anticipating application program andhardware component needs not yet felt and laying groundwork tofacilitate their eventual support, etc.

The APIs detailed in the present application are those for theMicrosoft® Windows 95™ (earlier known as Chicago) operating system.These APIs were developed in part to support recent innovations incomputer hardware, and in part to provide enhanced services toapplication programs.

As those skilled in the art will recognize, the Windows 95 APIs reflectmany inventive improvements over those of its predecessor operatingsystems—not just in terms of raw functionality provided by the improvedoperating system, but also in the manner the enhanced functionality ofthe Windows 95 operating system is made available for use by applicationprograms and hardware components. Among their other features, these APIsprovide access to the Windows 95 operating system functionality in amanner that is comprehensive, efficient, usable, extendible and, in somecases, reusable.

The foregoing and additional features of the present invention will bemore readily apparent from the following detailed description, whichproceeds with reference to the accompanying drawings.

DESCRIPTION OF THE DRAWINGS

FIG. 1 shows relationships between different types of computer software.

FIG. 2 is a block diagram of a computer with which the present inventioncan be utilized.

DETAILED DESCRIPTION

In the Microsoft Windows family of operating systems (as in manyoperating systems from other vendors), the “window” is a centralfeature. To the user, it is the visual feature through which allinteraction—both with applications and with the operating system—occurs.On a software level, it is the “object” through which mostcontrol/communication between the operating system and an applicationoccurs.

Rudimentary to windows are icons. Icons are small bit maps that can beused for a variety of purposes, one of the most familiar of which is torepresent Windows application programs that are available for execution.It is not unusual for a dozen or more icons to be displayed in a window.

The Windows 95 operating system includes a variety of new APIs andfunctions that facilitate display of icons (and other bitmaps) inwindows. While such functionality could, to some degree, be achieved inprior versions of the Windows operating system, the APIs of the presentinvention provide significant advantages, including efficiencies incoding of application programs and faster execution.

In Windows 95, windows are created in generally the same manner as inpredecessor versions of the Windows operating system, namely by use ofthe CreateWindow API. One of the parameters passed during invocation ofthis function is the window “class.” In Windows 95, a new class ofwindow has been defined, termed “list view control” (or simply “listview”). To create a list view window, CreateWindow is invoked with aspecification of “WC_LISTVIEW” as the window class. (The list viewwindow class is registered in the application's address space when thecommon controls dynamic-link library (DLL) is loaded.)

By requesting creation of a window of the “list view” class, theapplication programmer can use a rich set of new controls in displaying,arranging, and manipulating bit maps in the window. (The bit maps can,but need not, be icons.)

After creation, or manipulation, the application programmer can requestthat the window be presented on the screen by use of standard Windowsoperating system functions, e.g. the ShowWindow API.

The foregoing will be clearer from the following detailed analysis ofthe Windows 95 List View Controls, which is taken from documentationprovided to software developers to enable them to use these new APIs,macros, and functions.

About List View Controls

A list view control is a window that displays a collection of items,each item consisting of an icon and a label. List views provide severalways of arranging items and displaying individual items. For example,additional information about each item can be displayed in columns tothe right of the icon and label.

The application programmer can create a list view control by calling theCreateWindow or CreateWindowEx function, specifying the WC_LISTVIEWwindow class. This window class is registered when the common controlsdynamic-link library (DLL) is loaded. To ensure that this DLL is loaded,the application programmer can use the InitCommonControls function.

An application sends messages to a list view control to add, remove,arrange, and otherwise manipulate items. Each message has a macro thatthe application programmer can use instead of sending the messageexplicitly.

Like most common controls, a list view control sends notificationmessages to its parent window in the form of WM_NOTIFY messages.

Views and Styles

List view controls can display their contents in four different ways,called views. The current view is specified by the control's windowstyle. Additional window styles specify the alignment of items andcontrol-specific aspects of the list view control's functionality.Information about the four views follows. View Description Icon viewSpecified by the LVS_ICON window style. Each item appears as afull-sized icon with a label below it. The user can drag the items toany location in the list view window. Small icon view Specified by theLVS_SMALLICON window style. Each item appears as a small icon with thelabel to the right of it. The user can drag the items to any location.List view Specified by the LVS_LIST window style. Each item appears as asmall icon with a label to the right of it. Items are arranged incolumns and cannot be dragged to any arbitrary location by the user.Report view Specified by the LVS_REPORT window style. Each item appearson its own line with information arranged in columns. The leftmostcolumn contains the small icon and label, and subsequent columns containsubitems as specified by the application. Unless the LVS_NOCOLUMNHEADERwindow style is also specified, each column has a header.

The application programmer can change the view type after a list viewcontrol is created. To retrieve and change the window style, use theGetWindowLong and SetWindowLong functions. To isolate the window stylesthat correspond to the current view, use the LVS_TYPEMASK value.

The application programmer can control the way items are arranged inicon or small icon view by specifying one of the following windowstyles: LVS_ALIGNTOP (the default style), LVS_ALIGNBOTTOM,LVS_ALIGNLEFT, or LVS_ALIGNRIGHT. The application programmer can changethe alignment after a list view control is created. To isolate thewindow styles that specify the alignment of items, use the LVS_ALIGNMASKvalue.

Additional window styles control other options-for example, whether auser can edit labels in place, whether more than one item can beselected at a time, and so on.

List View Image Lists

The icons for list view items are contained in image lists, which theapplication programmer creates and assigns to the list view control. Oneimage list contains the full-sized icons used in icon view, and aseparate image list contains smaller versions of the same icons for usein other views. The application programmer can also specify a thirdimage list that contains state images, which are displayed next to anitem's icon to indicate an application-defined state.

The application programmer assigns an image list to a list view controlby using the LVM_SETIMAGELIST message, specifying whether the image listcontains large icons, small icons, or state images. The applicationprogrammer can use the GetSystemMetrics function to determineappropriate dimensions for large and small icons, and theImageList_Create function to create the image lists. For moreinformation about image lists, see the discussion in documentsCCTL32_(—)1.DOC, CCTL32_(—)2.DOC, DOC2.DOC, and WIN32UPD.DOC in theSDK/DDK documentation published by Microsoft on Oct. 28, 1994 (copyavailable in the application file).

The application programmer can retrieve the handle of an image listcurrently assigned to a list view control by using the LVM_GETIMAGELISTmessage.

The large and small icon image lists typically contain icons for eachtype of list view item. The application programmer need not create bothof these image lists if only one is used—for example, if a list viewcontrol is never in icon view. If the application programmer createsboth image lists, they must contain the same images in the same orderbecause a single value is used to identify a list view item's icon inboth image lists.

The large and small icon image lists can also contain overlay images,which are designed to be superimposed on item icons. A nonzero value inbits 8 through 11 of a list view item's state specifies the one-basedindex of an overlay image (zero indicates no overlay image). Because a4-bit, one-based index is used, overlay images must be among the first15 images in the image lists. For more information about list view itemstates, see the discussion of “Item States” in documentsCCTL32_(—)1.DOC, CCTL32_(—)2.DOC, DOC2.DOC, and USER32_(—)3.DOC in thecited SDK/DDK documentation.

If a state image list is specified, a list view control reserves spaceto the left of each item's icon for a state image. An application canuse state images, such as checked and cleared check boxes, to indicateapplication-defined item states. A nonzero value in bits 12 through 15specifies the one-based index of a state image (zero indicates no stateimage). State images are typically not used in icon view.

By default, a list view control destroys the image lists assigned to itwhen it is destroyed. If a list view control has the LVS_SHAREIMAGELISTSwindow style, however, the application is responsible for destroying theimage lists when they are no longer in use. The application programmershould specify this style if he or she assigns the same image lists tomultiple list view controls; otherwise, more than one control might tryto destroy the same image list.

Items and SubItems

Each item in a list view control consists of an icon, a label, a currentstate, and an application-defined value. One or more subitems can alsobe associated with each item. A subitem is a string that, in reportview, can be displayed in a column to the right of an item's icon andlabel. All items in a list view have the same number of subitems. Byusing list view messages, the application programmer can add, modify,retrieve information about, and delete items. The application programmercan also find items with specific attributes.

The LV_ITEM structure defines a list view item or subitem. TheiItemmember is the zero-based index of the item. TheiSubItem member is theone-based index of a subitem, or zero if the structure containsinformation about an item. Additional members specify the item's text,icon, state, and item data. Item data is an application-defined valueassociated with a list view item.

To add an item to a list view control, use the LVM_INSERTITEM message,specifying the address of an LV_ITEM structure. Before adding multipleitems, the application programmer can send the control anLVM_SETITEMCOUNT message, specifying the number of items the controlwill ultimately contain. This message enables the list view control toreallocate its internal data structures only once rather than every timethe application programmer adds an item. The application programmer candetermine the number of items in a list view control by using theLVM_GETITEMCOUNT message.

To change the attributes of a list view item, use the LVM_SETITEMmessage, specifying the address of an LV_ITEM structure. The mask memberof this structure specifies the item attributes the applicationprogrammer wants to change. To change only the text of an item orsubitem, use the LVM_SETITEMTEXT message.

To retrieve information about a list view item, use the LVM_GETITEMmessage, specifying the address of the LV_ITEM structure to fill in. Themask member specifies the item attributes to retrieve. To retrieve onlyan item or subitem's text, the application programmer can use theLVM_GETITEMTEXT message.

To delete a list view item, use the LVM_DELETEITEM message. Theapplication programmer can delete all items in a list view control byusing the LVM_DELETEALLITEMS message.

Item States

An item's state is a value that specifies the item's availability,indicates user actions, or otherwise reflects the item's status. A listview control changes some state bits, such as when the user selects anitem. An application might change other state bits to disable or hidethe item, or to specify an overlay image or state image. For moreinformation about overlay images and state images, see “List View ImageLists,” above.

An item's state is specified by the state member of the LV_ITEMstructure. When the application programmer specifies or changes anitem's state, the stateMask member specifies which state bits theapplication programmer wants to change. The application programmer canchange an item's state by using the LVM_SETITEMSTATE message. Theapplication programmer can specify an item's state when the applicationprogrammer creates it or when he or she changes its attributes by usingthe LMV_SETITEM message. To determine an item's current state, use theLVM_GETITEMSTATE or LVM_GETITEM message.

To set an item's overlay image, the stateMask member of the LV_ITEMstructure must include the LVIS_OVERLAYMASK value, and the state membermust include the one-based index of the overlay image shifted left 8bits by using the INDEXTOOVERLAYMASK macro. The index can be zero tospecify no overlay image.

To set an item's state image, the stateMask member of the LV_ITEMstructure must include the LVIS_STATEIMAGEMASK value, and the statemember must include the one-based index of the state image shifted left12 bits by using the INDEXTOSTATEIMAGEMASK macro. The index can be zeroto specify no state image.

Callback Items and the Callback Mask

A callback item is a list view item for which the application—ratherthan the control—stores the text, icon, or both. Although a list viewcontrol can store these attributes, the application programmer may wantto use callback items if the application already maintains some of thisinformation. The callback mask specifies which item state bits aremaintained by the application, and it applies to the whole controlrather than to a specific item. The callback mask is zero by default,meaning that the control tracks all item states. If an application usescallback items or specifies a nonzero callback mask, it must be able tosupply list view item attributes on demand.

A list view control requests any information it needs to display an itemby sending its owner window an LVN_GETDISPINFO notification message. Thespecified LV_DISPINFO structure identifies the item or subitem andindicates which attributes the application must supply. If itemattributes or state bits that are maintained by the application change,the list view control sends its owner window an LVN_SETDISPINFOnotification message. This notification enables the application toupdate its information.

If the application programmer changes a callback item's attributes, theapplication programmer can use the LVM_UPDATE message to force thecontrol to repaint the item. This message also arranges the list viewcontrol if it has the LVS_AUTOARRANGE style. The application programmercan use the LVM_REDRAWITEMS message to redraw a range of items byinvalidating the corresponding portions of the list view's client area.

The application programmer can define a callback item by specifyingappropriate values for the pszText and iImage members of the LV_ITEMstructure. If the application maintains the item's or subitem's text,specify the LPSTR_TEXTCALLBACK value for the pszText member. If theapplication keeps track of the icon for the item, specify theI_IMAGECALLBACK value for the iImage member.

To set the callback mask for a list view control, use theLVM_SETCALLBACKMASK message. A one bit in the callback mask means theapplication maintains the corresponding state bit for each list viewitem. To get the current callback mask, use the LVM_GETCALLBACKMASKmessage.

By effectively using callback items and the callback mask, theapplication programmer can ensure that each item attribute is maintainedin only one place. Doing this can simplify the application, but the onlyspace saved is the memory that would otherwise be required to store itemlabels and subitem text.

The application programmer can save a more significant amount of memoryby creating a list view control with the LVS_NOITEMDATA window style. Alist view control with this style keeps track of the number of items itcontains, but it does not save any information about each item. Ineffect, every item is a callback item. However, the applicationprogrammer must observe the following limitations when usingLVS_NOITEMDATA:

-   -   The control must be in report view. No other views can be used        because the control does not save the position of each item.    -   Label editing is not possible.    -   Item data cannot be assigned to list view items.    -   Item states cannot be set. The control does not maintain item        state information; it uses a different mechanism to keep track        of selected items and other states. However, the application        programmer can work around this by setting the callback mask.        Columns

Columns control the way items and their subitems are displayed in reportview. Each column has a title and width, and it is associated with aspecific subitem (subitem zero is the item's icon and label). Theattributes of a column are defined by an LV_COLUMN structure.

To add a column to a list view control, use the LVM_INSERTCOLUMNmessage. To delete a column, use the LVM_DELETECOLUMN message. Theapplication programmer can retrieve and change the properties of anexisting column by using the LVM_GETCOLUMN and LVM_SETCOLUMN messages.

To retrieve or change a column's width, use the LVM_GETCOLUMNWIDTH andLVM_SETCOLUMNWIDTH messages. The application programmer can determinethe minimum column width necessary to display all of a string by usingthe LVM_GETSTRINGWIDTH message.

Unless the LVS_NOCOLUMNHEADER window style is specified, column headersappear in report view. The user can click a column header, causing anLVN_COLUMNCLICK notification message to be sent to the parent window.Typically, the parent window sorts the list view by the specified columnwhen this occurs. The user can also drag the column guides between theheaders to size the columns.

Arranging, Sorting, Finding

The application programmer can use list view messages to arrange andsort items and to find items based on their attributes or positions.Arranging repositions items to align on a grid, but the indexes of theitems do not change. Sorting changes the sequence of items (and theircorresponding indexes) and then repositions them accordingly. Theapplication programmer can arrange items only in icon and small iconviews, but the application programmer can sort items in any view.

To arrange items, use the LVM_ARRANGE message. The applicationprogrammer can ensure that items are arranged at all times by specifyingthe LVS_AUTOARRANGE window style.

To sort items, use the LVM_SORTITEMS message. When the applicationprogrammer sorts using this message, the application programmerspecifies an application-defined callback function that is called tocompare the relative order of any two items. By supplying an appropriatecomparison function, the application programmer can sort items by theirlabel, by any subitem, or by any other property. Note that sorting itemsdoes not reorder the corresponding subitems. Thus, if any subitems arenot callback items, the application programmer must regenerate thesubitems after sorting.

The application programmer can ensure that a list view control is alwayssorted by specifying the LVS_SORTASCENDING or LVS_SORTDESCENDING windowstyle. The application programmer cannot supply a comparison functionwhen using these window styles. The list view sorts the items inascending or descending order by label.

The application programmer can find a list view item with specificproperties by using the LVM_FINDITEM message. The application programmercan find a list view item that is in a specified state and bears aspecified geometrical relationship to a given item by using theLVM_GETNEXTITEM message. For example, the application programmer canretrieve the next selected item to the right of a specified item.

Item Position

Every list view item has a position and size, which the applicationprogrammer can retrieve and set using messages. The applicationprogrammer can also determine which item, if any, is at a specifiedposition. The position of list view items is specified in viewcoordinates, which are client coordinates offset by the scroll position.

To retrieve and set an item's position, use the LVM_GETITEMPOSITION andLVM_SETITEMPOSITION messages. LVM_GETITEMPOSITION works for all views,but LVM_SETITEMPOSITION works only for icon and small icon views.

The application programmer can determine which item, if any, is at aparticular location by using the LVM_HITTEST message.

To get the bounding rectangles for a list item or for only its icon orlabel, use the LVM_GETITEMRECT message.

Scroll Position

Unless the LVS_NOSCROLL window style is specified, a list view controlcan be scrolled to show more items than can fit in the client area ofthe control. The application programmer can get a list view's scrollposition and related information, scroll a list view by a specifiedamount, or scroll a list view such that a specified list item isvisible.

In icon view or small icon view, the current scroll position is definedby the view origin. The view origin is the set of coordinates, relativeto the visible area of the list view, that correspond to the viewcoordinates (0, 0). To get the current view origin, use theLVM_GETORIGIN message. This message should be used only in icon or smallicon view; it returns an error in list or report view.

In list view or report view, the current scroll position is defined bythe top index. The top index is the index of the first visible item inthe list view control. To get the current top index, use theLVM_GETTOPINDEX message. This message returns a valid result only inlist or report view; it returns zero in icon or small icon view.

The application programmer can use the LVM_GETVIEWRECT message to getthe bounding rectangle of all items in a list view control, relative tothe visible area of the list view.

The LVM_GETCOUNTPERPAGE message returns the number of items that fit inone page of the list view. This message returns a valid result only inlist control and report views; in icon and small icon views, it returns,the total number of items.

To scroll a list view control by a specific amount, use the LVM_SCROLLmessage. Using the LVM_ENSUREVISIBLE message, the application programmercan scroll the list view, if necessary, to ensure that a specified itemis visible.

Label Editing

A list view control that has the LVS_EDITLABELS window style enables auser to edit item labels in place. The user begins editing by clickingthe label of an item that has the focus. An application can beginediting automatically by using the LVM_EDITLABEL message. The list viewcontrol notifies the parent window when editing begins and when it iscanceled or completed. When editing is completed, the parent window isresponsible for updating the item's label, if appropriate.

When label editing begins, a list view control sends its parent windowan LVN_BEGINLABELEDIT notification message. The application programmercan process this message to allow selective editing of specific labels;returning a nonzero value prevents label editing.

When label editing is canceled or completed, a list view control sendsits parent window an LVN_ENDLABELEDIT notification message. The lParamparameter is the address of an LV_DISPINFO structure identifying theitem and specifying the edited text. The parent window is responsiblefor updating the item's label, if appropriate, perhaps after validatingthe edited string. The iItem member is −1 if editing is canceled.

During label editing, the application programmer can get the handle ofthe edit control used for label editing by using the LVM_GETEDITCONTROLmessage. To limit the amount of text a user can enter, send the editcontrol an EM_LIMITTEXT message. The application programmer can evensubclass the edit control to intercept and discard invalid characters.The edit control is created after the LVN_BEGINLABELEDIT notificationmessage is sent.

List View Colors

An application can retrieve and set three colors for a list viewcontrol. To retrieve and set the text color, use the LVM_GETTEXTCOLORand LVM_SETTEXTCOLOR messages. To retrieve and set the text backgroundcolor, use the LVM_GETTEXTBKCOLOR and LVM_SETTEXTBKCOLOR messages. Toretrieve and set the window background color, use the LVM_GETBKCOLOR andLVM_SETBKCOLOR messages.

Notification Messages

A list view control sends notification messages to its parent window inthe form of WM_NOTIFY messages. The following table summarizes thenotification messages sent by a list view control. Notification messageDescription LVN_BEGINDRAG Signals the start of a drag-and-dropoperation. LVN_BEGINLABELEDIT Signals the start of in-place labelediting. LVN_BEGINRDRAG Signals the start of a drag-and-drop operation,using the right mouse button. LVN_COLUMNCLICK Indicates that the userclicked a column header in report view. LVN_DELETEALLITEMS Signals thedeletion of all list view items. LVN_DELETEITEM Signals the deletion ofa specific item. LVN_ENDDRAG Signals the end of a drag-and-dropoperation that was handled by the list view control rather than itsparent window. LVN_ENDLABELEDIT Signals the end of label editing.LVN_ENDRDRAG Signals the end of a drag-and-drop operation, using theright mouse button, that was handled by the list view control.LVN_GETDISPINFO Requests information that the list view control requiresto display an item. LVN_INSERTITEM Signals the insertion of a new listview item. LVN_ITEMCHANGED Indicates that an item has changed.LVN_ITEMCHANGING Indicates that an item is in the process of changing,and enables the parent window to accept or deny the change. LVN_KEYDOWNSignals a keyboard event. LVN_SETDISPINFO Notifies a parent window thatit must update the information it maintains for an item.Default Message Processing

The following table summarizes the message processing performed by alist view control. Messages specific to list view controls are discussedelsewhere and are, therefore, not included here. Message Processingperformed WM_CHAR Searches for a list view item that begins with thespecified character and, if found, selects and sets the focus to theitem. Multiple characters received within a time-out interval areconcatenated, and the list view searches for an item that begins withthe resulting string. WM_COMMAND Processes the EN_UPDATE andEN_KILLFOCUS edit control notification messages, and forwards all otheredit control notifica- tions to the parent window. WM_CREATE Performsadditional initialization. If the LVS_SHAREIMAGELISTS window style isnot specified, the list view control creates the icon and small iconimage lists at this point. WM_DESTROY Frees resources. WM_ERASEBKGNDErases the window background using the current background color for thelist view control. If the background color is the CLR_NONE value, thelist view control forwards the message to the parent window.WM_GETDLGCODE Returns a combination of the DLGC WANTTAB andDLGC_WANTARROWS values. WM_GETFONT Returns the handle of the currentlabel font. WM_HSCROLL Scrolls the list view horizontally. WM_KEYDOWNProcesses the spacebar, enter, and arrow keys, and sends a LVN_KEYDOWNnotification message to the parent window. WM_KILLFOCUS Repaints thefocused list item, if any, and sends a NM_KILLFOCUS notification messageto the parent window. WM_LBUTTONDBLCLK Sends the parent window anNM_DBLCLK notification message. WM_LBUTTONDOWN Processed in differentways depending on whether a click or drag operation is being initiated.To determine which operation is involved, the control enters a modalmessage loop until either the button is released or the mouse is moved.In the case of a click, the control may change which item has the focusand which items are selected, taking into account the cursor position,the state of the shift and ctrl keys, and so on. Then the list viewcontrol sends its parent window an NM_CLICK notification message. Ifdragging begins over an item, the control selects and sets the focus tothe item. Then it sends an LVN_BEGINDRAG notification message to theparent window. The parent window is responsible for actually carryingout the drag operation. If dragging begins over the window back- ground,the control enters another modal message loop, enabling the user to forma rectangle by dragging the mouse. Items within the rectangle areselected. WM_NCCREATE Allocates and initializes an internal datastructure, and then calls the DefWindowProc function. WM_NCDESTROY Freesresources allocated by the list view control. Unless theLVS_SHAREIMAGELISTS style is used, this includes deleting the image listand small image list. WM_NOTIFY Processes header control notificationmessages. WM_PAINT Displays any items in the update region. For callbackitems, the control first sends an LVN_GETDISPINFO notification messageto the owner window to request display information. WM_RBUTTONDOWNProcessed the same way as the WM_LBUTTONDOWN message, except that thecontrol sends an NM_RCLICK notification message (instead of NM_CLICK)and an LVN_BEGINRDRAG notification message (instead of LVN_BEGINDRAG).WM_SETFOCUS Repaints the focused list item, if any, and sends anNM_SETFOCUS notification message to the parent window. WM_SETFONT Savesthe specified font handle, forwards the message to the header window, ifany, and repaints using the new font. WM_SETREDRAW Turns redrawing on oroff. WM_TIMER Begins editing of an item label. If the user clicks thelabel of the focused item, the list view control sets a timer instead ofentering edit mode immediately. The timer makes it possible for thecontrol to not enter edit mode if the user double-clicks the label.WM_VSCROLL Scrolls the list view vertically. WM_WINDOWPOSCHANGED Updatesthe window scroll bars. If the current view is icon or small icon viewand the LVS_AUTOARRANGE style is specified, the list view control alsoarranges the list items. WM_WININICHANGE Processes changes to systemmetrics.Using List View Controls

This section contains examples demonstrating how to perform thefollowing tasks:

-   -   Create a list view control and initialize its image lists.    -   Add columns and items to the control.    -   Process notification messages from the control.    -   Change list view styles.        Creating a List View Control

To create a list view control, use the CreateWindow or CreateWindowExfunction, specifying the WC_LISTVIEW window class. The list view windowclass is registered in the application's address space when the commoncontrols dynamic-link library (DLL) is loaded. The applicationprogrammer can ensure that the DLL is loaded by using theInitCommonControls function.

The following example creates a list view control and then callsapplication-defined functions that add image lists, columns, and listview items. The window style specifies the control's initial view andother options. This example specifies report view, which enables theuser to edit the labels of list view items. // CreateListView - createsa list view control. // Returns the handle of the new control ifsuccessful or NULL //  otherwise. // hwndParent - handle of thecontrol's parent window // pfData - file containing list view items HWNDWINAPI CreateListView(HWND hwndParent, FILE *pfData) { HWND hwndLV; //Force the common controls DLL to be loaded. InitCommonControls( ); //Create the list view window. hwndLV = CreateWindow(WC_LISTVIEW, “”,WS_CHILD | LVS_REPORT | LVS_EDITLABELS, 0, 0, CW_USEDEFAULT,CW_USEDEFAULT, hwndParent, NULL, g_hinst, NULL); if (hwndLV == NULL)return NULL; // Call application-defined functions to initialize the //image lists, add columns, and add some items. if(!InitListViewImageLists(hwndLV) || !InitListViewColumns(hwndLV) ||!InitListViewItems(hwndLV, pfData)) { DestroyWindow(hwndLV); returnFALSE; } return hwndLV; // return the control's handle }Initializing the Image Lists for a List View

A list view control can have up to three image lists associated with it:one for item icons in large icon view, one for item icons in otherviews, and one for application-defined item states. The followingexample creates two image lists, adds an icon to each, and assigns themto a list view control by using the LVM_SETIMAGELIST message. //InitListViewImageList - creates image lists for a list view. // ReturnsTRUE if successful or FALSE otherwise. // hwndLV - handle of the listview control BOOL WINAPI InitListViewImageLists(HWND hwndLV) { HICONhiconItem; // icon for list view items HIMAGELIST himlLarge; // imagelist for icon view HIMAGELIST himlSmall; // image list for other views// Create the large and small icon image lists. himlLarge =ImageList_Create(GetSystemMetrics(SM_CXICON),GetSystemMetrics(SM_CYICON), TRUE, 1, 1); himlSmall =ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), TRUE, 1, 1); // Add an icon to each image list. hiconItem= LoadIcon(g_hinst, MAKEINTRESOURCE(IDI_ITEM));ImageList_AddIcon(himlLarge, hiconItem); ImageList_AddIcon(himlSmall,hiconItem); DeleteObject(hiconItem); // Assign the image lists to thelist view control. ListView_SetImageList(hwndLV, himlLarge,LVSIL_NORMAL); ListView_SetImageList(hwndLV, himlSmall, LVSIL_SMALL);return TRUE; }Adding Columns to a List View

Columns appear only in report view, and they enable multiple pieces ofinformation to be displayed for each list item. The applicationprogrammer can add columns to a list view control by using theLVM_INSERTCOLUMN message. Each item in a list view can have, in additionto its item text, any number of strings called subitems. When theapplication programmer adds a column to a list view, he or she specifieswhich subitem to display in the column.

Unless a list view has the LVS_NOCOLUMNHEADER window style, each columnhas a header showing the column name. The user can click the header andcan size the columns using the header.

The following example adds several columns to a list view control. Thecolumn headings are defined as string resources, which are consecutivelynumbered starting with IDS_FIRSTCOLUMN (defined in the application'sheader file). The number of columns is defined in the application'sheader file as C_COLUMNS. // InitListViewColumns - adds columns to alist view control. // Returns TRUE if successful or FALSE otherwise. //hwndLV - handle of the list view control BOOL WINAPIInitListViewColumns(HWND hwndLV) { extern char g_achTemp[256]; //temporary buffer LV_COLUMN lvc; int iCol; // Initialize the LV_COLUMNstructure. lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;lvc.fmt = LVCFMT_LEFT; lvc.cx = 100; lvc.pszText = g_achTemp; // Add thecolumns. for (iCol = 0; iCol < C_COLUMNS; iCol++) { lvc.iSubItem = iCol;LoadString(g_hinst, IDS_FIRSTCOLUMN + iCol, g_achTemp,sizeof(g_achTemp)); if (ListView_InsertColumn(hwndLV, iCol, &lvc) == −1)return FALSE; } return TRUE; }Adding Items to a List View

An application can add items to a list view control by using theLVM_INSERTITEM message. The attributes of a list view item that arespecified by an LV_ITEM structure include a state, a label, an icon, anditem data. Associated with each item may be one or more subitems, whichare strings that appear to the right of an item in report view.

The example in this section adds a list view item for each line in atext file. Semicolons are assumed to separate the item label and thesubitem strings that follow it. The example saves each item's label andsubitem strings in a structure, which is defined as follows in theapplication's header file. #define C_COLUMNS 6 typedef struct myitem_tag{ LPSTR aCols[C_COLUMNS]; } MYITEM;

The application then fills in an LV_ITEM structure and adds a list viewitem by using the LVM_INSERTITEM message. Because the application savesthe item label in its own application-defined MYITEM structure, itspecifies the LPSTR_TEXTCALLBACK value for the pszText member of theLV_ITEM structure. Specifying this value causes the control to send anLVN_GETDISPINFO notification message to its owner window whenever itneeds to display the item. The address of the application-definedstructure is saved as item data. // InitListViewItems - adds a items andsubitems to a list view. // Returns TRUE if successful or FALSEotherwise. // hwndLV - handle of the list view control // pfData - textfile containing list view items with columns // separated by semicolonsBOOL WINAPI InitListViewItems(HWND hwndLV, FILE *pfData) { extern charg_achTemp [256]; // temporary buffer PSTR pszStart; PSTR pszEnd; intiItem; int iSubItem; LV_ITEM lvi; // Initialize LV_ITEM members that arecommon to all items. lvi.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM |LVIF_STATE; lvi.state = 0; lvi.stateMask = 0; lvi.pszText =LPSTR_TEXTCALLBACK; // app. maintains text Ivi.iImage = 0; // image listindex // Read each line in the specified file. for (iItem = 0;fgets(g_achTemp, sizeof (g_achTemp), pfData); iItem++) { // Allocate anapplication-defined structure to store the // item label and the text ofeach subitem. MYITEM *pItem = LocalAlloc(LPTR, sizeof(MYITEM)); // Copythe first string (the label). pszEnd = strchr(g_achTemp, ‘;’); *pszEnd =‘\0’; pItem−>aCols[0] = DupString(g_achTemp); // Copy subsequent strings(subitems). for (iSubItem = 1; iSubItem < C_COLUMNS && pszEnd != NULL;iSubItem++) { pszStart = pszEnd + 1; if ((pszEnd = strchr (pszStart,‘;’)) != NULL) *pszEnd = '\0'; pItem−>aCols[iSubItem] =DupString(pszStart); } // Initialize item-specific LV_ITEM members.lvi.iItem = iItem; lvi.iSubItem = 0; lvi.lParam = (LPARAM) pItem; //item data // Add the item. ListView_InsertItem(hwndLV, &lvi); // Thereis no need to set the text of the subitems. They // default toLPSTR_TEXTCALLBACK. } return TRUE; } // DupString - allocates a copy ofa string. // lpsz - address of the null-terminated string to copy LPSTRDupString(LPSTR lpsz) { int cb = lstrlen(lpsz) + 1; LPSTR lpszNew =LocalAlloc(LMEM_FIXED, cb); if (lpszNew != NULL) CopyMemory(lpszNew,lpsz, cb); return lpszNew; }Processing the WM_NOTIFY Message

A list view control notifies its parent window of events by sending aWM_NOTIFY message. The wParam parameter is the identifier of thecontrol, and the lParam parameter is the address of an NMHDR structure(or to a larger structure, which has an NMHDR structure as its firstmember). The example in this section processes the LVN_GETDISPINFO,LVN_ENDLABELEDIT, and LVN_COLUMNCLICK notification messages.

A list view control sends the LVN_GETDISPINFO notification message toretrieve information about an item or subitem from the parent window.This notification is sent, for example, when an item with theLPSTR_TEXTCALLBACK value needs to be displayed.

A list view control sends the LVN_ENDLABELEDIT notification message whenthe user completes or cancels editing of an item's label. Thisnotification is only sent if the list view has the LVS_EDITLABELS windowstyle. If editing is being canceled, the parent window typically doesnothing. If editing is being completed, the parent window should set theitem label to the new text unless the item label is LPSTR_TEXTCALLBACK.In that case, the parent window should simply update theapplication-defined data it maintains for the list item.

A list view control sends the LVN_COLUMNCLICK notification message ifthe user clicks a column header in report view. Typically, anapplication sorts a list view by the specified column when this clickingoccurs. To sort, use the LVM_SORTITEMS message, specifying anapplication-defined comparison function.

The following example shows the portion of the application's windowprocedure that processes the WM_NOTIFY message.

case WM_NOTIFY: // Branch depending on the specific notificationmessage. switch (((LPNMHDR) lParam)−>code) { // Process LVN_GETDISPINFOto supply information about //  callback items. case LVN_GETDISPINFO:Main_OnGetDispInfo((LV_DISPINFO *) lParam); break; // ProcessLVN_ENDIABELEDIT to change item labels after // in-place editing. caseLVN_ENDLABELEDIT: return Main_OnEndLabelEdit( (LV_DISPINFO *) lParam );// Process LVN_COLUMNCLICK to sort items by column. case LVN_COLUMNCLICK: #define pnm ((NM_LISTVIEW *) lParam) ListView_SortItems (pnm−>hdr.hwndFrom, ListViewCompareFunc, (LPARAM) (pnm−>iSubItem) );#undef pnm break; } break;

The following example shows the application-defined functions that thewindow procedure uses to process list view notification messages. //Main_OnGetDispInfo - processes the LVN_GETDISPINFO //  notificationmessage. // pnmv - value of lParam (points to an LV_DISPINFO structure)VOID WINAPI Main_OnGetDispInfo(LV_DISPINFO *pnmv) { // Provide the itemor subitem's text if requested. if (pnmv−>item.mask & LVIF_TEXT) {MYITEM *pItem = (MYITEM *) (pnmv−>item.lParam);lstrcpy(pnmv−>item.pszText, pItem−>aCols[pnmv−>item.iSubItem]); } } //Main_OnEndLabelEdit - processes the LVN_ENDIABELEDIT //  notificationmessage. // Returns TRUE if the label is changed or FALSE otherwise. //pnmv - value of lParam (points to an LV_DISPINFO structure) BOOLMain_OnEndLabelEdit(LV_DISPINFO *pnmv) { MYITEM *pItem; // The item is−1 if editing is being canceled. if (pnmv−>item.iItem == −1) returnFALSE; // Copy the new text to the application-defined structure. // apointer to which is saved as item data. pItem = (MYITEM *)(pnmv−>item.lParam); pItem−>aCols[0] = (PSTR) LocalReAlloc ( (HLOCAL)(pItem- >aCols [0] ), lstrlen(pnmv−>item.pszText) + 1, LMEM_MOVEABLE );lstrcpy (pItem−>aCols[0], pnmv−>item.pszText); // No need to set theitem text, because it is a callback item. return TRUE; } //ListViewCompareFunc - sorts the list view control. It is a//  comparison function. // Returns a negative value if the first itemshould precede the //  second item, a positive value if the first itemshould //  follow the second item, and zero if the items are equivalent.// lParam1 and lParam2 - item data for the two items (in this //  case,pointers to application-defined MYITEM structures) // lParamSort - valuespecified by the LVM_SORTITEMS message //  (in this case, the index ofthe column to sort) int CALLBACK ListViewCompareFunc ( LPARAM lParam1,LPARAM lParam2, LPARAM lParamSort) { MYITEM *pItem1 = (MYITEM *)lparam1; MYITEM *pItem2 = (MYITEM *) lParam2; // Compare the specifiedcolumn. int iCmp = lstrcmpi(pItem1−>aCols[lParamSort], pItem2−>aCols[lParamSort]); // Return the result if nonzero. Otherwise, compare the// first column. return (iCmp != 0) ? iCmp: lstrcmpi(pItem1−>aCols[0],pItem2−>aCols[0]); }Changing List View Styles

An application can change the window style of a list view control afterit is created by using the GetWindowLong and SetWindowLong functions.The following example changes the style bits that govern the view mode.// SetView - sets a list view's window style to change the view. //hwndLV - handle of the list view control // dwView - value specifying aview style VOID WINAPI SetView (HWND hwndLV, DWORD dwView) { // Get thecurrent window style. DWORD dwStyle = GetWindowLong(hwndLV, GWL_STYLE);// Only set the window style if the view bits have changed. if ((dwStyle& LVS_TYPEMASK) != dwView) SetWindowLong (hwndLV , GWL_STYLE, (dwStyle &˜LVS_TYPEMASK) | dwView); }Reference

The list view messages, notification messages, and structures can begrouped as follows.

Items and Subitems

LV_ITEM

LVM_DELETEALLITEMS

LVM_DELETEITEM

LVM_GETITEM

LVM_GETITEMCOUNT

LVM_GETITEMSTATE

LVM_GETITEMTEXT

LVM_INSERTITEM

LVM_SETITEM

LVM_SETITEMCOUNT

LVM_SETITEMSTATE

LVM_SETITEMTEXT

Callback Items

LV_DISPINFO

LVM_GETCALLBACKMASK

LVM_REDRAWITEMS

LVM_SETCALLBACKMASK

LVM_UPDATE

LVN_GETDISPINFO

LVN_SETDISPINFO

Columns

LV_COLUMN

LVM_DELETECOLUMN

LVM_GETCOLUMN

LVM_GETCOLUMNWIDTH

LVM_GETSTRINGWIDTH

LVM_INSERTCOLUMN

LVM_SETCOLUMN

LVM_SETCOLUMNWIDTH

LVN_COLUMNCLICK

Arranging, Sorting, and Finding

LV_FINDINFO

LVM_ARRANGE

LVM_FINDITEM

LVM_GETNEXTITEM

LVM_SORTITEMS

Item Positions and Scrolling

LV_HITTESTINFO

LVM_ENSUREVISIBLE

LVM_GETCOUNTPERPAGE

LVM_GETITEMPOSITION

LVM_GETITEMRECT

LVM_GETORIGIN

LVM_GETTOPINDEX

LVM_GETVIEWRECT

LVM_HITTEST

LVM_SCROLL

LVM_SETITEMPOSITION

Colors

LVM_GETBKCOLOR

LVM_GETTEXTBKCOLOR

LVM_GETTEXTCOLOR

LVM_SETBKCOLOR

LVM_SETTEXTBKCOLOR

LVM_SETTEXTCOLOR

Miscellaneous

LV_KEYDOWN

LVM_CREATEDRAGIMAGE

LVM_EDITLABEL

LVM_GETEDITCONTROL

LVM_GETIMAGELIST

LVM_SETIMAGELIST

LVN_BEGINDRAG

LVN_BEGINLABELEDIT

LVN_BEGINRDRAG

LVN_DELETEALLITEMS

LVN_DELETEITEM

LVN_ENDDRAG

LVN_ENDLABELEDIT

LVN_ENDRDRAG

LVN_INSERTITEM

LVN_ITEMCHANGED

LVN_ITEMCHANGING

LVN_KEYDOWN

NM_LISTVIEW

Messages

An application sends messages to a list view control to alter itsappearance, add or change items and columns, and so on. Each message hasa corresponding macro, which the application programmer can use insteadof sending the message explicitly. LVM_ARRANGE LVM_ARRANGE wParam =(WPARAM) (int) code; lParam = 0; // Corresponding macro BOOLListview_Arrange(HWND hwnd, UINT code);

Arranges items in icon view. The application programmer can send thismessage explicitly or by using the ListView_Arrange macro.

-   -   Returns TRUE if successful or FALSE otherwise.        hwnd

Handle of the list view control.

code

Alignment that can be combined with an optional sort flag. The alignmentcan be one of these values: LVA_ALIGNBOTTOM Aligns items along thebottom edge of the window. LVA_ALIGNLEFT Aligns items along the leftedge of the window. LVA_ALIGNRIGHT Aligns items along the right edge ofthe window. LVA_ALIGNTOP Aligns items along the top edge of the window.LVA_DEFAULT Aligns items according to the list view's current alignmentstyles (the default value). LVA_SNAPTOGRID Snaps all icons to thenearest grid position.

The sort flag, if specified, sorts items by text in ascending ordescending order. It can be the LVA_SORTASCENDING or LVA_SORTDESCENDINGvalue. LVM_CREATEDRAGIMAGE LVM_CREATEDRAGIMAGE wParam = (WPARAM) (int)iItem; lParam = (LPARAM) (LPPOINT) lpptUpLeft; // Corresponding macroHIMAGELIST ListView_CreateDragImage(HWND hwnd, int iItem. LPPOINTlpptUpLeft);

Creates a drag image list for the specified item. The applicationprogrammer can send this message explicitly or by using theListView_CreateDraglmage macro.

-   -   Returns the handle of the drag image list if successful or NULL        otherwise.        hwnd and iItem

Handle of the list view control, and the index of the item.

lpptUpLeft

Address of a POINT structure that receives the initial location of theupper left corner of the image, in view coordinates. LVM_DELETEALLITEMSLVM_DELETEALLITEMS wParam = 0; lParam = 0; // Corresponding macro BOOLListView_DeleteAllItems(HWND hwnd);

Removes all items from a list view control. The application programmercan send this message explicitly or by using the ListView_DeleteAllItemsmacro.

-   -   Returns TRUE if successful or FALSE otherwise.        hwnd

Handle of the list view control. LVM_DELETECOLUMN LVM_DELETECOLUMNwParam = (WPARAM) (int) iCol; lParam = 0; // Corresponding macro BOOLListView_DeleteColumn(HWND hwnd, int iCol);

Removes a column from a list view control. The application programmercan send this message explicitly or by using the ListView_DeleteColumnmacro.

-   -   Returns TRUE if successful or FALSE otherwise.        hwnd and iCol

Handle of the list view control, and the index of the column to delete.LVM_DELETEITEM LVM_DELETEITEM wParam = (WPARAM) (int) iItem; lParam = 0;// Corresponding macro BOOL ListView_DeleteItem(HWND hwnd, int iItem);

Removes an item from a list view control. The application programmer cansend this message explicitly or by using the ListView_DeleteItem macro.

-   -   Returns TRUE if successful or FALSE otherwise.        hwnd and iItem

Handle of the list view control, and the index of the list view item todelete. LVM_EDITLABEL LVM_EDITLABEL wParam = (WPARAM) (int) iItem;lParam = 0; // Corresponding macro HWND ListView_EditLabel(HWND hwnd,int iItem);

Begins in-place editing of the specified list view item's text. Themessage implicitly selects and focuses the specified item. Theapplication programmer can send this message explicitly or by using theListView_EditLabel macro.

-   -   Returns the handle of the edit control that is used to edit the        item text if successful or NULL otherwise.        hwnd and iItem

Handle of the list view control, and the index of the list view item.

When the user completes or cancels editing, the edit control isdestroyed and the handle is no longer valid. The application programmercan safely subclass the edit control, but do not destroy it. To cancelediting, the application programmer can send the list view control aWM_CANCELMODE message. LVM_ENSUREVISIBLE LVM_ENSUREVISIBLE wParam =(WPARAM) (int) iItem; lParam = (LPARAM) (BOOL) fPartialOk; //Corresponding macro BOOL ListView_EnsureVisible(HWND hwnd, int i, BOOLfPartialOK);

Ensures that a list view item is entirely or at least partially visible,scrolling the list view control if necessary. The application programmercan send this message explicitly or by using the ListView_EnsureVisiblemacro.

-   -   Returns TRUE if successful or FALSE otherwise.        hwnd and i

Handle of the list view control, and the index of the list view item.

fPartialOk

Value specifying whether the item must be entirely visible. If thisparameter is TRUE, no scrolling occurs if the item is at least partiallyvisible. LVM_FINDITEM LVM_FINDITEM wParam = (WPARAM) (int) iStart;lParam = (LPARAM) (const LV_FINDINFO FAR *) plvfi; // Correspondingmacro int ListView_FindItem(HWND hwnd, int iStart, const LV_FINDINFOFAR* plvfi);

Searches for a list view item with specified characteristics. Theapplication programmer can send this message explicitly or by using theListView_FindItem macro.

-   -   Returns the index of the item if successful or −1 otherwise.        hwnd

Handle of the list view control.

iStart

Index of the item to begin the search with or -1 to start from thebeginning. The specified item is itself excluded from the search.

plvfi

Address of an LV_FINDINFO structure that contains information about whatto search for. LVM_GETBKCOLOR LVM_GETBKCOLOR wParam = 0; lParam = 0; //Corresponding macro COLORREF ListView_GetBkColor(HWND hwnd);

Retrieves the background color of a list view control. The applicationprogrammer can send this message explicitly or by using theListView_GetBkColor macro.

-   -   Returns the background color of the list view.        hwnd

Handle of the list view control. LVM_GETCALLBACKMASK LVM_GETCALLBACKMASKwParam = 0; lParam = 0; // Corresponding macro UINTListView_GetCallbackMask(HWND hwnd);

Retrieves the callback mask for a list view control. The applicationprogrammer can send this message explicitly or by using theListView_GetCallbackMask macro.

-   -   Returns the callback mask.        hwnd

Handle of the list view control. LVM_GETCOLUMN LVM_GETCOLUMN wParam =(WPARAM) (int) iCol; lParam = (LPARAM) (LV_COLUMN FAR *) pool; //Corresponding macro BOOL ListView_GetColumn(HWND hwnd, int iCol,LV_COLUMN FAR* pcol);

Retrieves the attributes of a list view control's column. Theapplication programmer can send this message explicitly or by using theListView_GetColumn macro.

-   -   Returns TRUE if successfull or FALSE otherwise.        hwnd and iCol

Handle of the list view control, and the index of the column.

pcol

Address of an LV_COLUMN structure that specifies the information toretrieve and receives information about the column. The mask memberspecifies which column attributes to retrieve. If the mask memberspecifies the LVCF_TEXT value, the pszText member must contain theaddress of the buffer that receives the item text and the cchTextMaxmember must specify the size of the buffer. LVM_GETCOLUMNWIDTHLVM_GETCOLUMNWIDTH wParam = (WPARAM) (int) iCol; lParam = 0; //Corresponding macro int ListView_GetColumnWidth(HWND hwmd, int iCol);

Retrieves the width of a column in report view or list view. Theapplication programmer can send this message explicitly or by using theListView_GetColumnWidth macro.

-   -   Returns the column width if successful or zero otherwise.        hwnd and iCol

Handle of the list view control, and the index of the column. The iColparameter is ignored in list view. LVM_GETCOUNTPERPAGELVM_GETCOUNTPERPAGE wParam = 0; lParam = 0; // Corresponding macro intListView_GetCountPerPage(HWND hwnd);

Calculates the number of items that can fit vertically in the visiblearea of a list view control when in list view or report view. Theapplication programmer can send this message explicitly or by using theListView_GetCountPerPage macro.

-   -   Returns the number of items if successful. If the current view        is icon or small icon view, the return value is the total number        of items in the list view.        hwnd

Handle of the list view control. LVM_GETEDITCONTROL LVM_GETEDITCONTROLwParam = 0; lParam = 0; // Corresponding macro HWNDListView_GetEditControl(HWND hwnd, int i);

Retrieves the handle of the edit control being used to edit a list viewitem's text. The application programmer can send this message explicitlyor by using the ListView_GetEditControl macro.

-   -   Returns the handle of the edit control if successful or NULL        otherwise.        hwnd and i

Handle of the list view control, and the index of the list view item.

If no label is being edited, the return value is NULL. The edit controlis not created until after the LVN_BEGINLABELEDIT notification messageis sent.

When the user completes or cancels editing, the edit control isdestroyed and the handle is no longer valid. The application programmercan safely subclass the edit control, but do not destroy it. To cancelediting, the application programmer can send the list view aWM_CANCELMODE message.

The list view item being edited is the currently focused item—that is,the item in the focused state. To find an item based on its state, usethe LVM_GETNEXTITEM message. LVM_GETIMAGELIST LVM_GETIMAGELIST wParam =(WPARAM) (int) iImageList; lParam =0; // Corresponding macro HIMAGELISTListView_GetImageList(HWND hwnd, int iImageList);

Retrieves the handle of an image list used for drawing list view items.The application programmer can send this message explicitly or by usingthe ListView_GetlmageList macro.

-   -   Returns the handle of the specified image list if successful or        NULL otherwise.        hwnd

Handle of the list view control.

iImageList

Value specifying which image list to retrieve. It can be one of thesevalues: LVSIL_NORMAL Image list with large icons LVSIL_SMALL Image listwith small icons LVSIL_STATE Image list with state images

LVM_GETITEM LVM_GETITEM wParam = 0; lParam = (LPARAM) (LV_ITEM FAR*)pitem; // Corresponding macro BOOL ListView_GetItem(HWND hwnd, LV_ITEMFAR* pitem);

Retrieves some or all of a list view item's attributes. The applicationprogrammer can send this message explicitly or by using theListView_GetItem macro.

-   -   Returns TRUE if successful or FALSE otherwise.        hwnd

Handle of the list view control.

pitem

Address of an LV_ITEM structure that specifies the information toretrieve and receives information about the list view item.

When the message is sent, the iItem and iSubItem members identify theitem or subitem to retrieve information about and the mask memberspecifies which attributes to get. For a list of possible values, seethe description of the LV_ITEM structure.

If the mask member specifies the LVIF_TEXT value, the pszText membermust contain the address of the buffer that receives the item text andthe cchTextMax member must specify the size of the buffer.

If the mask member specifies the LVIF_STATE value, the stateMask memberspecifies which item states are to be returned. LVM_GETITEMCOUNTLVM_GETITEMCOUNT wParam = 0; lParam = 0; // Corresponding macro intListView_GetItemCount(HWND hwnd);

Retrieves the number of items in a list view control. The applicationprogrammer can send this message explicitly or by using theListView_GetItemCount macro.

-   -   Returns the number of items.        hwnd

Handle of the list view control. LVM_GETITEMPOSITION LVM_GETITEMPOSITIONwParam = (WPARAM) (int) i; lParam = (LPARAM) (POINT FAR *) ppt; //Corresponding macro BOOL ListView_GetItemPosition(HWND hwmd, int i,POINT FAR* ppt);

Retrieves the position of a list view item. The application programmercan send this message explicitly or by using theListView_GetItemPosition macro.

-   -   Returns TRUE if successful or FALSE otherwise.        hwnd and i

Handle of the list view control, and the index of the list view item.

ppt

Address of a POINT structure that receives the position of the item'supper left corner, in view coordinates.

If a list view control has the LVS_NOITEMDATA style, this macro cannotbe used in icon or small icon view. LVM_GETITEMRECT LVM_GETITEMRECTwParam = (WPARAM) (int) i; lParam = (LPARAM) (LPRECT) prc; //Corresponding macro BOOL ListView_GetItemRect(HWND hwnd, int i, RECTFAR* prc, int code);

Retrieves the bounding rectangle for all or part of an item in thecurrent view. The application programmer can send this messageexplicitly or by using the ListView-GetItemRect macro.

-   -   Returns TRUE if successful or FALSE otherwise.        hwnd and i

Handle of the list view control, and the index of the list view item.

prc

Address of a RECT structure that receives the bounding rectangle. Whenthe message is sent, the left member of this structure contains thevalue of the code parameter.

code

Portion of the list view item for which to retrieve the boundingrectangle. It can be one of these values: LVIR_BOUNDS Returns thebounding rectangle of the entire item, including the icon and label.LVIR_ICON Returns the bounding rectangle of the icon or small icon.LVIR_LABEL Returns the bounding rectangle of the item text.

This parameter is specified by the left member of the RECT structurepointed to by the prc parameter. LVM_GETITEMSTATE LVM_GETITEMSTATEwParam = (WPARAM) (int) i; lParam = (LPARAM) (UINT) mask; //Corresponding macro UINT WINAPI ListView_GetItemState(HWND hwnd, int i,UINT mask);

Retrieves the state of a list view item. The application programmer cansend this message explicitly or by using the ListView_GetItemStatemacro.

-   -   Returns the item's state flags.        hwnd and i

Handle of the list view control, and the index of the list view item.

mask

Mask specifying which of the item's state flags to return.LVM_GETITEMTEXT LVM_GETITEMTEXT wParam = (WPARAM) (int) iItem; lParam =(LPARAM) (LV_ITEM FAR *) pitem; // Corresponding macro void WINAPIListView_GetItemText(HWND hwnd, int iItem, int iSubItem, LPSTR pszText,int cchTextMax);

Retrieves the text of a list view item or subitem.

If the application programmer sends this message explicitly, it returnsthe length of the retrieved string, and it has the following parameters:

hwnd and iItem

Handle of the list view control, and the index of the list view item.

pitem

Address of an LV_ITEM structure. TheiSubItem member specifies the indexof a subitem, or it can be zero to get the item label. The pszTextmember points to a buffer that receives the text, and the cchTextMaxmember specifies the size of the buffer.

The application programmer can send this message implicitly by using theListView_GetItemText macro. The macro has no return value, and it hasthe following parameters:

hwnd and iItem

Handle of the list view control, and the index of the list view item.

iSubItem

Index of the subitem, or zero to retrieve the item label.

pszText and cchTextMax

Address of the buffer that receives the item or subitem text, and thesize of the buffer, in bytes. LVM_GETNEXTITEM LVM_GETNEXTITEM wParam =(WPARAM) (int) istart; lParam = MAKELPARAM((UINT) flags, 0); //Corresponding macro int ListView_GetNextItem(HWND hwnd, int iStart, UINTflags);

Searches for a list view item that has the specified properties and thatbears the specified relationship to a given item. The applicationprogrammer can send this message explicitly or by using theListView_GetNextItem macro.

-   -   Returns the index of the next item if successful or -1        otherwise.        hwnd

Handle of the list view control.

iStart

Index of the item to begin the searching with, or −1 to find the firstitem that matches the specified flags. The specified item itself isexcluded from the search.

flags

Geometric relation of the requested item to the specified item, and thestate of the requested item. The geometric relation can be one of thesevalues: LVNI_ABOVE Searches for an item that is above the specifieditem. LVNI_ALL Searches for a subsequent item by index (the defaultvalue). LVNI_BELOW Searches for an item that is below the specifieditem. LVNI_PREVIOUS Searches for a previous item by index. LVNI_TOLEFTSearches for an item to the left of the specified item. LVNI_TORIGHTSearches for an item to the right of the specified item.

The state can be zero, or it can be one or more of these values:LVNI_DROPHILITED The item has the LVIS_DROPHILITED state flag set.LVNI_FOCUSED The item has the LVIS_FOCUSED state flag set. LVNI_HIDDENThe item has the LVIS_HIDDEN state flag set. LVNI_MARKED The item hasthe LVIS_MARKED state flag set. LVNI_SELECTED The item has theLVIS_SELECTED state flag set.

If an item does not have all of the specified state flags set, thesearch continues with the next item. LVM_GETORIGIN LVM_GETORIGIN wParam= 0; lParam = (LPARAM) (LPPOINT) lpptOrg; // Corresponding macro BOOLListView_GetOrigin(HWND hwnd, LPPOINT lpptOrg);

Retrieves the current view origin for a list view control. Theapplication programmer can send this message explicitly or by using theListView_GetOrigin macro.

-   -   Returns TRUE if successful or FALSE if the current view is list        view or report view.        hwnd

Handle of the list view control.

lpptOrg

Address of a POINT structure that receives the view origin.LVM_GETSTRINGWIDTH LVM_GETSTRINGWIDTH wParam = 0; lParam = (LPARAM)(LPCSTR) psz; // Corresponding macro int ListView_GetStringWidth(HWNDhwnd, LPCSTR psz);

Determines the minimum column width necessary to display all of a givenstring. You can send this message explicitly or by using theListView_GetStringWidth macro.

-   -   Returns the column width if successful or zero otherwise.        hwnd

Handle of the list view control.

psz

Address of a null-terminated string.

The returned width takes into account the current font and columnmargins of the list view control, but it does not take into account thewidth of a small icon. LVM_GETTEXTBKCOLOR LVM_GETTEXTBKCOLOR wParam = 0;lParam = 0; // Corresponding macro COLORREF ListView_GetTextBkColor(HWNDhwind);

Retrieves the text background color of a list view control. Theapplication programmer can send this message explicitly or by using theListView_GetTextBkColor macro.

-   -   Returns the background color of the text.        hwnd

Handle of the list view control. LVM_GETTEXTCOLOR LVM_GETTEXTCOLORwParam = 0; lParam = 0; // Corresponding macro COLORREFListView_GetTextColor(HWND hwnd);

Retrieves the text color of a list view control. The applicationprogrammer can send this message explicitly or by using theListView_GetTextColor macro.

-   -   Returns the text color.        hwnd

Handle of the list view control. LVM_GETTOPINDEX LVM_GETTOPINDEX wParam= 0; lParam = 0; // Corresponding macro int ListView_GetTopIndex(HWNDhwnd);

Retrieves the index of the topmost visible item when in list view orreport view. The application programmer can send this message explicitlyor by using the ListView_GetTopIndex macro.

-   -   Returns the index of the item if successful or zero if the list        view is in icon or small icon view.        hwnd

Handle of the list view control. LVM_GETVIEWRECT LVM_GETVIEWRECT wParam= 0; lParam = (LPARAM) (RECT FAR *) prc; // Corresponding macro BOOLListView_GetViewRect(HWND hwnd, RECT FAR* prc);

Retrieves the bounding rectangle of all items in the list view control.The list view must be in icon or small icon view. The applicationprogrammer can send this message explicitly or by using theListView_GetViewRect macro.

-   -   Returns TRUE if successful or FALSE otherwise.        hwnd

Handle of the list view control.

prc

Address of a RECT structure that receives the bounding rectangle. Allcoordinates are relative to the visible area of the list view.LVM_HITTEST LVM_HITTEST wParam = 0; lParam = (LPARAM) (LV_HITTESTINFOFAR *) pinfo; // Corresponding macro int ListView_HitTest(HWND hwnd,LV_HITTESTINFO FAR* pinfo);

Determines which list view item, if any, is at a specified position. Theapplication programmer can send this message explicitly or by using theListView_HitTest macro.

-   -   Returns the index of the item at the specified position, if any,        or −1 otherwise.        hwnd

Handle of the list view control.

pinfo

Address of a LV_HITTESTINFO structure that contains the position to hittest and receives information about the results of the hit test.LVM_INSERTCOLUMN LVM_INSERTCOLUMN wParam = (WPARAM) (int) iCol; lParam =(LPARAM) (const LV_COLUMN FAR *) pcol; // Corresponding macro intListView_InsertColumn(HWND hwnd, int iCol, const LV_COLUMN FAR* pcol);

Inserts a new column in a list view control. The application programmercan send this message explicitly or by using the ListView_InsertColumnmacro.

-   -   Returns the index of the new column if successful or −1        otherwise.        hwnd and iCol

Handle of the list view control, and the index of the new column.

pcol

Address of an LV_COLUMN structure that contains the attributes of thenew column. LVM_INSERTITEM LVM_INSERTITEM wParam = 0; lParam = (LPARAM)(const LV_ITEM FAR *) pitem; // Corresponding macro intListView_InsertItem(HWND hwnd, const LV_ITEM FAR* pitem);

Inserts a new item in a list view control. The application programmercan send this message explicitly or by using the ListView_InsertItemmacro.

-   -   Returns the index of the new item if successful or −1 otherwise.        hwnd

Handle of the list view control.

pitem

Address of an LV_ITEM structure that specifies the attributes of thelist view item. TheiItem member specifies the index of the new item.TheiSubItem member must be zero; the macro cannot be used to insertsubitems. LVM_REDRAWITEMS LVM_REDRAWITEMS wParam = 0; lParam =MAKELPARAM((int) iFirst, (int) , iLast); // Corresponding macro BOOLListView_RedrawItems(HWND hwnd, int iFirst, int iLast);

Forces a list view control to repaint a range of items. The applicationprogrammer can send this message explicitly or by using theListView_RedrawItems macro.

-   -   Returns TRUE if successful or FALSE otherwise.        hwnd

Handle of the list view control.

iFirst and iLast

Index of the first and last items to repaint.

The specified items are not actually repainted until the list viewwindow receives a WM_PAINT message. To repaint immediately, call theUpdateWindow function after using this macro. LVM_SCROLL LVM_SCROLLwParam = 0; lParam = MAKELPARAM((int) dx, (int) dy); // Correspondingmacro BOOL ListView_Scroll(HWND hwnd, int dx, int dy);

Scrolls the content of a list view control. The application programmercan send this message explicitly or by using the ListView_Scroll macro.

-   -   Returns TRUE if successful or FALSE otherwise.        hwnd

Handle of the list view control.

dx and dy

Amount of horizontal and vertical scrolling, in pixels. If the currentview is report view, dx must be zero and dy is the number of lines toscroll. LVM_SETBKCOLOR LVM_SETBKCOLOR wParam = 0; lParam = (LPARAM)(COLORREF) clrBk; // Corresponding macro BOOL ListView_SetBkColor(HWNDhwnd, COLORREF clrBk);

Sets the background color of the list view control. The applicationprogrammer can send this message explicitly or by using theListView_SetBkColor macro.

-   -   Returns TRUE if successful or FALSE otherwise.        hwnd

Handle of the list view control.

clrBk

Background color to set, or the CLR_NONE value for no background color.List view controls with background colors redraw themselvessignificantly faster than those without background colors.LVM_SETCALLBACKMASK LVM_SETCALLBACKMASK wParam = (WPARAM) (UINT) mask;lParam = 0; // Corresponding macro BOOL ListView_SetCallbackMask(HWNDhwnd, UINT mask);

Sets the callback mask for a list view control. The applicationprogrammer can send this message explicitly or by using theListView_SetCallbackMask macro.

-   -   Returns TRUE if successful or FALSE otherwise.        hwnd

Handle of the list view control.

mask

New value of the callback mask. LVM_SETCOLUMN LVM_SETCOLUMN wParam =(WPARAM) (int) iCol; lParam = (LPARAM) (const LV_COLUMN FAR *) pcol; //Corresponding macro BOOL ListView_SetColumn(HWND hwnd, int iCol,LV_COLUMN FAR* pcol);

Sets the attributes of a list view column. The application programmercan send this message explicitly or by using the ListView_SetColumnmacro.

-   -   Returns TRUE if successful or FALSE otherwise.        hwnd and iCol

Handle of the list view control, and the index of the column.

pcol

Address of an LV_COLUMN structure that contains the new columnattributes. The mask member specifies which column attributes to set.

If the mask member specifies the LVCF_TEXT value, the pszText member isthe address of a null-terminated string and the cchTextMax member isignored. LVM_SETCOLUMNWIDTH LVM_SETCOLUMNWIDTH wParam = (WPARAM) (int)iCol; lParam = MAKELPARAM((int) cx, 0); // Corresponding macro BOOLListView_SetColumnWidth(HWND hwnd, int iCol, int cx);

Changes the width of a column in report view or list view. Theapplication programmer can send this message explicitly or by using theListView_SetColumnWidth macro.

-   -   Returns TRUE if successful or FALSE otherwise.        hwnd and iCol

Handle of the list view control, and the index of the column. In listview, the iCol parameter must be −1.

cx

New width of the column. LVM_SETIMAGELIST LVM_SETIMAGELIST wParam =(WPARAM) (int) iImageList; lParam = (LPARAM) (HIMAGELIST) himl; //Corresponding macro BOOL ListView_SetImageList(HWND hwnd, HIMAGELISThiml, int iImageList);

Assigns an image list to a list view control. The application programmercan send this message explicitly or by using the ListView_SetImage Listmacro.

-   -   Returns TRUE if successful or FALSE otherwise.        hwnd

Handle of the list view control.

himl

Handle of the image list to assign.

iImageList

Type of image list. It can be one of these values: LVSIL_NORMAL Imagelist with large icons LVSIL_SMALL Image list with small iconsLVSIL_STATE Image list with state images

LVM_SETITEM LVM_SETITEM wParam = 0; lParam = (LPARAM) (const LV_ITEM FAR*) pitem; // Corresponding macro BOOL ListView_SetItem(HWND hwnd, constLV_ITEM FAR* pitem);

Sets some or all of a list view item's attributes. The applicationprogrammer can send this message explicitly or by using theListView_SetItem macro.

-   -   Returns TRUE if successful or FALSE otherwise.        hwnd

Handle of the list view control.

pitem

Address of an LV_ITEM structure that contains the new item attributes.TheiItem and iSubItem members identify the item or subitem, and the maskmember specifies which attributes to set.

If the mask member specifies the LVIF_TEXT value, the pszText member isthe address of a null-terminated string and the cchTextMax member isignored.

If the mask member specifies the LVIF_STATE value, the stateMask memberspecifies which item states to change and the state member contains thevalues for those states. LVM_SETITEMCOUNT LVM_SETITEMCOUNT wParam =(WPARAM) (int) cItems; lParam = 0; // Corresponding macro VOIDListview_SetItemCount(HWND hwnd, int cItems);

Prepares a list view control for adding a large number of items. Theapplication programmer can send this message explicitly or by using theListView_SetItemCount macro.

-   -   No return value.        hwnd

Handle of the list view control.

cItems

Number of items that the control will ultimately contain.

By sending this message before adding a large number of items, theapplication programmer enables a list view control to reallocate itsinternal data structures only once rather than every time theapplication programmer adds an item. LVM_SETITEMPOSITIONLVM_SETITEMPOSITION wParam = (LPARAM) (int) i; lParam = MAKELPARAM((int)x, (int) y); // Corresponding macro BOOL ListView_SetItemPosition(HWNDhwnd,int i, int x, int y);

Moves an item to a specified position in a list view control. Thecontrol must be in icon or small icon view. The application programmercan send this message explicitly or by using theListView_SetItemPosition macro.

-   -   Returns TRUE if successful or FALSE otherwise.        hwnd and i

Handle of the list view control, and the index of the list view item.

x and y

New position of the item's upper left corner, in view coordinates.

If the list view control has the LVS_AUTOARRANGE style, the list view isarranged after the position of the item is set. This macro cannot beused for list views that have the LVS_NOITEMDATA style. LVM_SETITEMSTATELVM_SETITEMSTATE wParam = (WPARAM) (int) i; lParam = (LPARAM) (LV_ITEMFAR *) pitem; // Corresponding macro BOOL WINAPIListView_SetItemState(HWND hwnd, int i, UINT state, UINT mask);

Changes the state of an item in a list view control.

If the application programmer sends this message explicitly, it returnsTRUE if successful or FALSE otherwise, and it has the followingparameters:

hwnd and i

Handle of the list view control, and the index of the list view item.

pitem

Address of an LV_ITEM structure. The stateMask member specifies whichstate bits to change, and the state member contains the new values forthose bits. The other members are ignored.

The application programmer can send this message implicitly by using theListView_SetItemState macro. The macro has no return value, and it hasthe following parameters:

hwnd and i

Handle of the list view control, and the index of the list view item.

state and mask

Value containing the new state bits for the item, and a mask specifyingwhich of the item's current state bits to change. LVM_SETITEMTEXTLVM_SETITEMTEXT wParam = (WPARAM) (int) i; lParam = (LPARAM) (LV_ITEMFAR *) pitem; // Corresponding macro VOID WINAPIListView_SetItemText(HWND hwnd, int i, int iSubItem, LPCSTR pszText);

Changes the text of a list view item or subitem.

If the application programmer sends this message explicitly, it returnsTRUE if successful or FALSE otherwise, and it has the followingparameters:

hwnd and i

Handle of the list view control, and the index of the list view item.

pitem

Address of an LV_ITEM structure. TheiSubItem member is the index of thesubitem, or it can be zero to set the item label. The pszText member isthe address of a null-terminated string containing the new text; themember can also be NULL.

The application programmer can send this message implicitly by using theListView_SetItemText macro. The macro has no return value, and it hasthe following parameters:

hwnd and i

Handle of the list view control, and the index of the list view item.

iSubItem

Index of the subitem, or zero to set the item label.

psztext

Address of a null-terminated string containing the new text. Thisparameter can be NULL. LVM_SETTEXTBKCOLOR LVM_SETTEXTBKCOLOR wParam = 0;lParam = (LPARAM) (COLORREF) clrText; // Corresponding macro BOOLListView_SetTextBkColor(HWND hwnd, COLORREF clrText);

Sets the background color of text in a list view control. Theapplication programmer can send this message explicitly or by using theListView_SetTextBkColor macro.

-   -   Returns TRUE if successful or FALSE otherwise.        hwnd

Handle of the list view control.

clrText

New text color. LVM_SETTEXTCOLOR LVM_SETTEXTCOLOR wParam = 0; lParam =(LPARAM) (COLORREF) clrText; // Corresponding macro BOOLListView_SetTextColor(HWND hwnd, COLORREF clrText);

Sets the text color of a list view control. The application programmercan send this message explicitly or by using the ListView_SetTextColormacro.

-   -   Returns TRUE if successful or FALSE otherwise.        hwnd

Handle of the list view control.

clrText

New text color. LVM_SORTITEMS LVM_SORTITEMS wParam = (WPARAM) (LPARAM)lParamSort; lParam = (LPARAM) (PFNLVCOMPARE) pfnCompare; //Corresponding macro BOOL ListView_SortItems(HWND hwnd, PFNLVCOMPAREpfnCompare, LPARAM lParamSort);

Sorts list view items using an application-defined comparison function.The index of each item changes to reflect the new sequence. Theapplication programmer can send this message explicitly or by using theListView_SortItems macro.

-   -   Returns TRUE if successful or FALSE otherwise.        hwnd

Handle of the list view control.

pfnCompare

Address of the application-defined comparison function. The comparisonfunction is called during the sort operation each time the relativeorder of two list items needs to be compared. For more information, seebelow. lParamSort

Application-defined value that is passed to the comparison function.

The comparison function has the following form:

-   -   int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM        lParamSort);

The comparison function must return a negative value if the first itemshould precede the second, a positive value if the first item shouldfollow the second, or zero if the two items are equivalent.

The lParam1 and lParam2 parameters specify the item data for the twoitems being compared. The lParamSort parameter is the same value passedto the LVM_SORTITEMS message. LVM_UPDATE LVM_UPDATE wParam = (WPARAM)iItem; lParam = 0; // Corresponding macro BOOL ListView_Update(HWNDhwnd, int iItem);

Updates a list view item. If the list view control has theLVS_AUTOARRANGE style, this macro causes the list view to be arranged.The application programmer can send this message explicitly or by usingthe ListView_Update macro.

-   -   Returns TRUE if successful or FALSE otherwise.        hwnd and iItem

Handle of the list view control, and the index of the item to update.

Notification Messages

A list view control sends notification messages, in the form ofWM_NOTIFY messages, to its owner window when events occur in thecontrol. LVN_BEGINDRAG LVN_BEGINDRAG pnmv = (NM_LISTVIEW FAR *) lParam;

Notifies a list view control's parent window that a drag-and-dropoperation involving the left mouse button is being initiated. Thisnotification message is sent in the form of a WM_NOTIFY message.

-   -   No return value.        pnmv

Address of an NM_LISTVIEW structure. The iItem member identifies theitem being dragged, and the other members are zero. LVN_BEGINLABELEDITLVN_BEGINLABELEDIT pdi = (LV_DISPINFO FAR *) lParam;

Notifies a list view control's parent window about the start of labelediting for an item. This notification message is sent in the form of aWM_NOTIFY message.

-   -   Returns FALSE to allow label editing or TRUE to prevent it.        pdi

Address of an LV_DISPINFO structure containing information about theitem LVN_BEGINRDRAG LVN_BEGINRDRAG pnmv = (NM_LISTVIEW FAR *) lParam;

Notifies a list view control's parent window that a drag-and-dropoperation involving the right mouse button is being initiated. Thisnotification message is sent in the form of a WM_NOTIFY message.

-   -   No return value.        pnmv

Address of an NM_LISTVIEW structure. TheiItem member identifies the itembeing dragged, and the other members are zero. LVN_COLUMNCLICKLVN_COLUMNCLICK pnmv = (NM_LISTVIEW FAR *) lParam;

Notifies a list view control's parent window that a column was clicked.This notification message is sent in the form of a WM_NOTIFY message.

-   -   No return value.        pnmv

Address of an NM_LISTVIEW structure. TheiItem member is −1, and theiSubItem member identifies the column. All other members are zero.LVN_DELETEALLITEMS pnmv = (NM_LISTVIEW FAR *) lParam;

Notifies a list view control's parent window that all items in the listview were deleted. This notification message is sent in the form of aWM_NOTIFY message.

-   -   No return value.        pnmv

Address of an NM_LISTVIEW structure. TheiItem member is −1, and theother members are zero. LVN_DELETEITEM LVN_DELETEITEM pnmv =(NM_LISTVIEW FAR *) lParam;

Notifies a list view control's parent window that an item was deleted.This notification message is sent in the form of a WM_NOTIFY message.

-   -   No return value.        pnmv

Address of an NM_LISTVIEW structure. The iItem member identifies thedeleted item, and the other members are zero. LVN_ENDDRAG LVN_ENDDRAGpnmv = (NM_LISTVIEW FAR *) lParam;

Notifies a list view control's parent window about the end of defaultprocessing for a drag-and-drop operation involving the left mousebutton. This notification message is sent in the form of a WM_NOTIFYmessage.

-   -   No return value.        pnmv

Address of an NM_LISTVIEW structure. The !Item member identifies thedragged item, and the ptAction member specifies the screen coordinatesof the drop location. The other members are zero. LVN_ENDLABELEDITLVN_ENDLABELEDIT pdi = (LV_DISPINFO FAR *) lParam;

Notifies a list view control's parent window about the end of labelediting for an item. This notification message is sent in the form of aWM_NOTIFY message.

-   -   No return value.        pdi

Address of an LV_DISPINFO structure. TheiItem member identifies theitem, or it is −1 if editing is being canceled. LVN_ENDRDRAGLVN_ENDRDRAG pnmv = (NM_LISTVIEW FAR *) lParam;

Notifies a list view control's parent window about the end of defaultprocessing for a drag-and-drop operation involving the right mousebutton. This notification message is sent in the form of a WM_NOTIFYmessage.

-   -   No return value.        pnmv

Address of an NM_LISTVIEW structure. TheiItem member identifies thedragged item, and the ptAction member specifies the screen coordinatesof the drop location. The other members are zero. LVN_GETDISPINFOLVN_GETDISPINFO pnmv = (LV_DISPINFO FAR *) lParam;

Requests that a list view control's parent window provides informationneeded to display or sort an item. This notification message is sent inthe form of a WM_NOTIFY message.

-   -   No return value.        pnmv

Address of an LV_DISPINFO structure that specifies the type informationrequired and that receives the information. LVN_INSERTITEMLVN_INSERTITEM pnmv = (NM_LISTVIEW FAR *) lParam;

Notifies a list view control's parent window that a new item wasinserted. This notification message is sent in the form of a WM_NOTIFYmessage.

-   -   No return value.        pnmv

Address of an NM_LISTVIEW structure. The iItem member identifies the newitem, and the other members are zero. LVN_ITEMCHANGED LVN_ITEMCHANGEDpnmv = (NM_LISTVIEW FAR *) lParam;

Notifies a list view control's parent window that an item has changed.This notification message is sent in the form of a WM_NOTIFY message.

-   -   No return value.        pnmv

Address of an NM_LISTVIEW structure that identifies the item andspecifies which of its attributes have changed. LVN_ITEMCHANGINGLVN_ITEMCHANGING pnmv = (NM_LISTVIEW FAR *) lParam;

Notifies a list view control's parent window that an item is changing.This notification message is sent in the form of a WM_NOTIFY message.

-   -   Returns TRUE to allow the change or FALSE to prevent the change.        pnmv

Address of an NM_LISTVIEW structure that identifies the item andspecifies which of its attributes are changing. LVN_KEYDOWN LVN_KEYDOWNpnkd = (LV_KEYDOWN FAR *) lParam;

Notifies a list view control's parent window that a key has beenpressed. This notification message is sent in the form of a WM_NOTIFYmessage.

-   -   No return value.        pnkd

Address of an LV_KEYDOWN structure. LVN_SETDISPINFO LVN_SETDISPINFO pnmv= (LV_DISPINFO FAR *) lParam;

Notifies a list view control's parent window that it must update theinformation it maintains for an item. This notification message is sentin the form of a WM_NOTIFY message.

-   -   No return value.        pnmv

Address of an LV_DISPINFO structure specifying information for thechanged item.

Structures

The following structures are used with list view messages andnotification messages. LV_COLUMN typedef struct _LV_COLUMN { UINT mask;// see below int fmt; // see below int cx; // width of the column, inpixels LPSTR pszText; // see below int cchTextMax; // see below intiSubItem; // index of subitem associated with column } LV_COLUMN;

Contains information about a column in report view. This structure isalso used to receive information about a column.

mask

Variable specifying which members contain valid information. It can beLVCF_ALL (meaning all members), zero, or one or more of these values:LVCF_FMT The fmt member is valid. LVCF_SUBITEM The iSubItem member isvalid. LVCF_TEXT The pszText member is valid. LVCF_WIDTH The ex memberis valid.fmt

Alignment of the column. It can be one of these values: LVCFMT_LEFT,LVCFMT_RIGHT, or LVCFMT_CENTER.

pszText

Address of a null-terminated string containing the column heading if thestructure contains information about a column. If the structure isreceiving information about a column, this member specifies the addressof the buffer that receives the column heading.

cchTextMax

Size of the buffer pointed to by the pszText member. If the structure isnot receiving information about a column, this member is ignored.

This structure is used with the LVM_GETCOLUMN, LVM_SETCOLUMN,LVM_INSERTCOLUMN, and LVM_DELETECOLUMN messages. LV_DISPINFO typedefstruct tagLV_DISPINFO { NMHDR hdr; // required for all WM_NOTIFYmessages LV_ITEM item; // see below } LV_DISPINFO;

Contains information needed to display an owner-drawn item in a listview control.

item

LV_ITEM structure identifying the item or subitem. The structure eithercontains or receives 40 information about the item. The mask memberspecifies which item attributes are relevant, and it can be one or moreof these values: LVIF_IMAGE The iImage member specifies, or is toreceive, the index of the item's icon in the image list. LVIF_STATE Thestate member specifies, or is to receive, the state of the item.LVIF_TEXT The pszText member specifies the new item text or the addressof a buffer that is to receive the item text.

If the structure is receiving item text, the pszText and cchTextMaxmembers specify the address and size of a buffer. The applicationprogrammer can either copy text to the buffer or assign the address of astring to the pszText member. In the latter case, the applicationprogrammer must not change or delete the string until the correspondingitem text is deleted or two additional LVN_GETDISPINFO messages havebeen sent.

This structure is used with the LVN_GETDISPINFO and LVN_SETDISPINFOnotification messages. LV_FINDINFO typedef struct _LV_FINDINFO { UINTflags; //see below LPCSTR psz; //see below LPARAM lParam; //see below }LV_FINDINFO;

Contains information used to search for a list view item.

flags

Type of search to perform. It can be one or more of these values:LVFI_NOCASE Ignores case in string comparisons. This value is ignored ifthe LVFI_STRING value is not specified. LVFI_PARAM Searches based on thelParam member. The lParam member of the matching item's LV_ITEMstructure must match the lParam member of this structure. If this valueis specified, all other values are ignored. LVFI_PARTIAL Matches if theitem text begins with the string pointed to by the psz member. Thisvalue implies use of the LVFI_STRING value, and it cannot be used withthe LVFI_SUBSTRING value. LVFI_STRING Searches based on item text.Unless additional values are specified, the item text of the matchingitem must exactly match the string pointed to by the psz member.LVFI_SUBSTRING Matches if the string pointed to by the psz member iscontained anywhere in the item text. This value implies use of theLVFI_STRING value, and it cannot be used with the LVFI_PARTIAL value.LVFI_WRAP Continues the search at the beginning if no match is found.psz

Address of a null-terminated string to compare with item text if theflags member specifies the LVFI_STRING, LVFI_SUBSTRING, or LVFI_PARTIALvalue.

lParam

Value to compare with the lParam member of a list view item's LV_ITEMstructure if the flags member specifies the LVFI_PARAM value.

This structure is used with the LVM_FINDITEM message. LV_HITTESTINFOtypedef struct _LV_HITTESTINFO { POINT pt; // position to hit test, inclient coordinates UINT flags; // see below int iItem; // receives theindex of the matching item } LV_HITTESTINFO;

Contains information about a hit test.

flags

Variable that receives information about the results of a hit test. Itcan be one or more of these values: LVHT_ABOVE The position is above theclient area of the control. LVHT_BELOW The position is below the clientarea of the control. LVHT_NOWHERE The position is inside the list viewcontrol's client window but is not over a list item. LVHT_ONITEMICON Theposition is over a list view item's icon. LVHT_ONITEMLABEL The positionis over a list view item's text. LVHT_ONITEMSTATEICON The position isover the state image of a list view item. LVHT_TOLEFT The position is tothe left of the list view control's client area. LVHT_TORIGHT Theposition is to the right of the list view control's client area.

The application programmer can use the LVHT_ABOVE, LVHT_BELOW,LVHT_TOLEFIT, and LVHT_TORIGHT values to determine whether to scroll thecontents of a list view control. Two of these flags may be combined, forexample if the position is above and to the left of the client area.

The application progranmer can test for the LVHT_ONITEM value todetermine whether a given position is over a list view item. This valueis a bitwise OR operation on the LVHT_ONITEMICON, LVHT_ONITEMLABEL, andLVHT_ONITEMSTATEICON values.

This structure is used with the LVM_HITTEST message. LV_ITEM typedefstruct _LV_ITEM { UINT mask; // see below int iItem; // item thisstructure refers to int iSubItem; // subitem this refers to, or zeroUINT state; // see below UINT stateMask; // see below LPSTR pszText; //see below int cchTextMax; // see below int iImage; // see below LPARAMlParam; // 32-bit value to associate with item } LV_ITEM;

Specifies or receives the attributes of a list view item.

mask

Variable specifying which members contain valid data or which membersare to be filled in. It can be one or more of these values: LVIF_TEXTThe pszText member is valid. LVIF_IMAGE The iImage member is valid.LVIF_PARAM The lParam member is valid. LVIF_STATE The state member isvalid.state and statemask

Current state of the item, and the valid states of the item. This membercan be any valid combination of state flags.

pszText

Address of a null-terminated string containing the item text if thestructure specifies item attributes. If this member is theLPSTR_TEXTCALLBACK value, the item is a callback item.

If the structure is receiving item attributes, this member is theaddress of the buffer that receives the item text.

cchTextMax

Size of the buffer pointed to by the pszText member if the structure isreceiving item attributes. If the structure specifies item attributes,this member is ignored.

iImage

Index of the list view item's icon in the large icon and small iconimage lists. If this member is the I_IMAGECALLBACK value, the item is acallback item.

This structure is used with a number of messages, including LVM_GETITEM,LVM_SETITEM, LVM_INSERTITEM, and LVM_DELETEITEM. LV KEYDOWN typedefstruct tagLV_KEYDOWN { NMHDR hdr; // required for all WM_NOTIFY messagesWORD wVKey; // virtual-key code UINT flags; // always zero } LV_KEYDOWN;

Contains information about a keyboard event in a list view control. Thisstructure is used with the LVN_KEYDOWN notification message. NM LISTVIEWtypedef struct tagNM_LISTVIEW { NMHDR hdr; // required for all WM_NOTIFYmessages int iItem; // list view item, or −1 if not used int iSubItem;// subitem, or zero if none UINT uNewState; // see below UINT uOldState;// see below UINT uChanged; // see below POINT ptAction; // see below }NM_LISTVIEW;

Contains information about a list view notification message.

uNewState and uOldState

New item state, and the old item state. Both members are zero fornotification messages that do not use them.

uChanged

Item attributes that have changed. This member is zero for notificationsthat do not use it. Otherwise, it can have the same values as the maskmember of the LV_ITEM structure.

ptAction

Location at which the event occurred. This member is valid only for theLVN_BEGINDRAG and LVN_BEGINRDRAG notification messages.

The address of this structure is specified as the lParam parameter ofthe WM_NOTIFY message for several list view notification messages.

Constants

The tables in the following sections describe window style flags anditem state flags used with list view controls.

List View Window Styles

The following window styles are specific to list view controls:LVS_ALIGNBOTTOM Specifies that items are aligned along the bottom of thecontrol in icon and small icon view. LVS_ALIGNLEFT Specifies that itemsare left- aligned in icon and small icon view. LVS_ALIGNRIGHT Specifiesthat items are right- aligned in icon and small icon view. LVS_ALIGNTOPSpecifies that items are aligned with the top of the control in icon andsmall icon view. LVS_AUTOARRANGE Specifies that icons are auto-matically kept arranged in icon view and small icon view. LVS_BUTTONSpecifies that item icons look like buttons in large icon view.LVS_EDITLABELS Allows item text to be edited in place. The parent windowmust process the LVN_ENDLABELEDIT notification message. LVS_ICONSpecifies icon view. LVS_LIST Specifies list view. LVS_NOCOLUMNHEADERSpecifies that a column header is not displayed in report view. Bydefault, columns have headers in report view. LVS_NOITEMDATA Allocatesonly enough space to store the state of each item, not the label, icon,subitem strings, or application-defined data. The parent window mustprocess the LVN_GETDISPINFO notification message to provide thisinformation to the list view control on demand. LVS_NOLABELWRAP Displaysitem text on a single line in icon view. By default, item text may wrapin icon view. LVS_NOSCROLL Disables scrolling. All items must be withinthe client area. LVS_NOSORTHEADER Specifies that column headers do notwork like buttons. This style is useful if clicking a column header inreport view does not carry out an action, such as sorting.LVS_OWNERDRAWFIXED Enables the owner window to paint items in reportview. The list view control sends a WM_DRAWITEM message to paint eachitem; it does not send separate messages for each subitem. The itemDatamember of the DRAWITEMSTRUCT structure contains the item data for thespecified list view item. LVS_REPORT Specifies report view.LVS_SHAREIMAGELISTS Specifies that the control does not take ownershipof the image lists assigned to it (that is, it does not destroy theimage lists when it is destroyed). This style enables the same imagelists to be used with multiple list view controls. LVS_SINGLESEL Allowsonly one item at a time to be selected. By default, multiple items maybe selected. LVS_SMALLICON Specifies small icon view. LVS_SORTASCENDINGSorts items based on item text in ascending order. LVS_SORTDESCENDINGSorts items based on item text in descending order.

The application programmer can use the LVS_TYPESTYLEMASK value toisolate the window styles that correspond to the current view: LVS_ICON,LVS_SMALLICON, LVS_LIST, and LVS_REPORT.

The application programmer can use the LVS_ALIGNMASK value to isolatethe window styles that specify the alignment of items: LVS_ALIGNLEFT,LVS_ALIGNRIGHT, LVS_ALIGNBOTTOM, and LVS_ALIGNTOP.

List View Item States

An item's state determines its appearance and functionality. The statecan be zero, or one or more of these values: LVIS_CUT The item is markedfor a cut or move operation. LVIS_DISABLED The item is disabled, so itis drawn using the standard disabled style and coloring.LVIS_DROPHILITED The item is highlighted as a drag-and-drop target.LVIS_FOCUSED The item has the focus, so it is surrounded by a standardfocus rectangle. Although more than one item may be selected, only oneitem can have the focus. LVIS_HIDDEN The item is not visible, so itcannot be acted on by the user. LVIS_LINK The item is a link.LVIS_PUSHED The button-like item appears pushed. This value has noeffect unless the LVS_BUTTON window style is used. LVIS_SELECTED Theitem is selected. The appearance of a selected item depends on whetherit has the focus and on the system colors used for selection.

The application programmer can use the LVIS_OVERLAYMASK value to isolatethe state bits that contain the one-based index of the overlay image.The application programmer can use the LVIS_STATEIMAGEMASK value toisolate the state bits that contain the one-based index of the stateimage.

Discussion of Figures

FIG. 1 is a block diagram of various of the hardware and softwarecomponents of a contemporary computer system 10 with which the presentinvention can be employed. Among the hardware components 12 are the CPU14, a memory 16, a disk drive 18, and a variety of peripheral devices20. Among the software components are the operating system 22, one ormore applications 24, and several device drivers 26.

Applications 24 and the operating system 22 communicate via theApplications Program Interfaces (APIs) 28. As noted, these are thespecial instructions by which the applications 24 request services of(or through) the operating system 22. Associated with most APIs arevarious sets of parameters, through which data relating to the requestedservice is passed between the application and the operating system.(Although not shown separately, the applications and operating systemalso communicate via “messages” and “macros” (also referred to herein as“APIs”). Generally speaking, messages relay data between differentcomponents of the computer system (including applications programs, theoperating system, and various data structures maintained by theoperating system such as windows). Macros are generally comparable toAPI service requests, but pass their parameters using different datastructures. Many operating system services can be requested by either anAPI or by a macro.)

Related to APIs are DDIs. DDIs (Device Driver Interfaces) 30 areinstruction by which the operating system 22 requests services from ahardware device 20 through its device driver 26. For the sake ofbrevity, DDIs and the responses thereto are also regarded as “APIs” asused herein.

As noted above and illustrated in FIG. 1, applications 24 cancommunicate directly with the hardware 12 by use of assembly language32. (For clarity of illustration, the assembly lanuage instructions inFIG. 1 are shown as applied directly to the hardware. Actually, theinstructions are processed by the operation system prior to execution bythe hardware.)

FIG. 2 is a more detailed block diagram of the hardware components 12 ofthe computer system 10 illustrated in FIG. 1. The hardware includes acomputer 34, one or more input devices 36, and one or more outputdevices 38.

The illustrated computer 34 includes a central processing unit (CPU) 14and a memory system 40 that communicate through a bus structure 42. CPU14 includes an arithmetic logic unit (ALU) 44 for performingcomputations, registers 46 for temporary storage of data andinstructions, and a control unit 48 for controlling the operation ofcomputer in response to software instructions.

Memory system 40 generally includes high-speed main memory 16 in theform of random access memory (RAM) and read only memory (ROM)semiconductor devices.

Main memory 16 stores software such as the operating system 22, devicedrivers 26, and currently running applications 24. Main memory 16 alsoincludes video display memory for displaying images through a displaydevice. Memory system 40 further includes secondary storage 18 in theform of floppy disks, hard disks, tape, CD-ROM, etc., for long term datastorage.

Input devices 36 and output devices 38 are typically peripheral devicesconnected by bus structure 42 to computer 34. Input devices 36 caninclude a keyboard, modem, pointing device, pen, or other device forproviding input data to the computer. Output devices 38 can include adisplay device, printer, sound device or other device for providingoutput data from the computer.

It should be understood that FIG. 2 illustrates the basic elements of ageneral purpose computer system; the figure is not intended toillustrate a specific architecture. For example, no particular busstructure is shown because different known bus structures can be used tointerconnect the elements of the computer system in a number of ways, asdesired. CPU 14 can comprise a discrete ALU 44, registers 46 and controlunit 48, or can be a single device in which these parts of the CPU areintegrated together, such as in a microprocessor. (The illustratedembodiment employs an Intel 80486 microprocessor, but a variety of othermicroprocessors can alternatively be used.) Moreover, the number andarrangement of the elements of the computer system can be varied fromwhat is shown and described in ways known in the art (i.e., multipleCPUs, client-server systems, computer networking, etc.).

The APIs 28 used in the Microsoft Windows 95 operating system are asuperset of those used in predecessor Microsoft Windows operatingsystems (e.g. Microsoft Windows 3.1, Windows for Workgroups, and WindowsNT). The use of Microsoft Windows, and particularly the use of MicrosoftWindows APIs in writing applications programs and device drivers, iswell understood by those skilled in the art, and is abundantly detailedin the published literature, including the following (each published byMicrosoft Press, One Microsoft Way, Redmond, Wash. 98052-6399): King,Adrian, “Inside Windows 95,” ISBN 1-55615-626-X, 1994; “The Developer'sGuide to Plug'n Play: The Official Guide to Designing Hardware forWindows,” ISBN 1-55615-642-1, 1994; Catapult, Inc. Staff, “MicrosoftWindows NT Workstation Step by Step,” ISBN 1-55615-695-2, 1994; Jamsa,Chris, “Concise Guide to Windows, 2d ed.” ISBN 1-55615-666-9, 1994;“Windows NT Resource Guide, Vol. 1,” ISBN 1-55615-653-7, 1994; “WindowsNT Network Resource Guide, Vol. 2,” ISBN 1-55615-656-1, 1994; “WindowsNT Messages, Vol. 3,” ISBN 1-55615-654-5, 1994; “Optimizing Windows NT,Vol. 4,” ISBN 1-55615-655-3, 1994; “Microsoft Windows NT Resource Kit:The Information & Tools You Need to Become a Windows NT Expert, Version3.5 for Workstation & Advanced Server Editions, 2d. ed.” (4 vols.) ISBN1-55615-657-X, 1994; “Microsoft ODBC 2.0 Programmer's Reference & SDKGuide: For Microsoft Windows & Windows NT,” ISBN 1-55615-658-8, 1994;Custer, Helen, “Inside the Windows NT File System,” ISBN 1-55615-660-X,1994; Nelson, Steve, “Field Guide to Windows 3.1,” ISBN 1-55615-640-5,1994; Catapult Inc. Staff, “Microsoft Windows NT Step by Step,” ISBN1-55615-573-5, 1993; Blake, Russ, “Optimizing Windows NT,” ISBN1-55615-619-7, 1993; Richter, Jeffrey, “Advanced Windows NT,” ISBN1-55615-56-0, 1993; Stinson, Craig, “Running Windows NT,” ISBN1-55615-572-7, 1993; Groves, James A., “Windows NT Answer Book,” ISBN1-55615-562-X, 1993; Borland, Russell, “Windows NT Companion,” ISBN1-55615-554-9, 1993; Microsoft Staff, “Microsoft LAN Manager for WindowsNT,” ISBN 1-55615-543-3, 1993; Microsoft Staff, “Microsoft Win32Programmers Reference,” (3 vols.) ISBN 1-55615-517-4, 1993; Petzold,Charles, “Programming Windows 3.1, 3d. ed.,” ISBN 1-55615-395-3, 1992;“Windows Interface,” ISBN 1-55615-439-9, 1992; Custer, Helen, “InsideWindows Network,” ISBN 1-55615-481-X, 1992;Catapult, Inc. Staff,“Microsoft Windows 3.1, Step by Step,” ISBN 1-55615-501-8, 1992;Petzold, Charles, “Programming Graphics for Windows,” ISBN1-55615-395-3, 1992; “Microsoft Windows 3.1 Programmer's Reference,” (4vols.) ISBN 1-55615-494-1, 1992; “Microsoft Windows Multimedia Authoring& Tools Guide,” ISBN 1-55615-391-0, 1991; “Microsoft Windows MultimediaProgrammer's Workbook,” ISBN 1-55615-390-2, 1991; “Microsoft WindowsMultimedia Programmer's Reference,” ISBN 1-55615-389-9, 1991; “TheWindows Interface: An Application Design Guide,” ISBN 1-55615-384-8,1992. (All volumes without author listings are by Microsoft CorporationStaff.)

Other Applications

The following applications are incorporated herein by reference (onlythe first named inventor is listed):

Belfiore, Joseph “Method and System for Transferring Data to CommonDestinations Using a Common Destination List,” U.S. Pat. No. 5,694,563,Issued Dec. 2, 1997 and Filed Dec. 13, 1994;

Bogdan, Jeffrey L., “System Provided Window Elements Having AdjustableDimensions,” U.S. Pat. No. 5,977,966, Issued Nov. 2, 1999 and Filed Apr.28, 1993;

Chew, Chee Heng, “System Provided Child Window Controls,” Ser. No.08/355,400, Filed Dec. 13, 1994, now abandoned;

Chew, Chee Heng, “Method and System for Combining Prefix and FirstCharacter Searching of a List,” U.S. Pat. No. 5,692,173, Issued Nov. 25,1997 and Filed Dec. 13, 1994;

Ellison-Taylor, Ian M., “Method and System for Aligning Windows on aScreen,” Ser. No. 08/161788, Filed Dec. 3, 1993, now abandoned;

Ellison-Taylor, Ian M., “Taskbar With Start Menu,” Ser. No. 08/354,916,Filed Dec. 13, 1994, now abandoned;

Glasser, Daniel S., “Method and System for Controlling User Access to aResource in a Networked Computing Environment,” Ser. No. 08/355,409,Filed Dec. 13, 1994, now abandoned;

Guzak, Christopher J., “Tree View Control,” Ser. No. 08/355,408, FiledDec. 13, 1994, now abandoned;

Guzak, Christopher J., “Data Transfer With Expanded Clipboard Formats,”Ser. No. 08/355,397, Filed Dec. 13, 1994, now abandoned;

Jones, Greg, “Method and System for Accessing Shell Folder Capabilitiesby an Application Program,” Ser. No. 08/356,081, Filed Dec. 13, 1994,now abandoned;

Jones, Greg, “Method and System for Authenticating Access toHeterogeneous Computing Services,” Ser. No. 5,655,077, Issued Aug. 5,1997 and Filed Dec. 13, 1994;

Kanamori, Atsushi, “Method and System for Providing a Group of ParallelResources as a Proxy for a Single Shared Resource,” U.S. Pat. No.5,754,854, Issued May 19, 1998 and Filed Nov. 14, 1994;

Kanamori, Atsushi, “Method and System for Threaded Resource Allocationand Reclamation,” U.S. Pat. No. 6,363,410, Issued Mar. 26, 2002 andFiled Dec. 13, 1994;

Lipe, Ralph A., “Method and Apparatus for Installing Device Drivers on aComputer,” Ser. No. 08/271,058, Filed Jul. 5, 1994, now abandoned;

Lipe, Ralph A., “Computer System Messaging Architecture,” U.S. Pat. No.5,784,615, Issued Jul. 21, 1998 and Filed Dec. 13, 1994;

Mabry, Jonathon E., “Automatic Installation of Printers in a DistributedEnvironment,” Ser. No. 08/318,070, Filed Oct. 5, 1994, now abandoned;

Moore, George M., “Method and System for Providing Substitute ComputerFonts,” Ser. No. 08/085,482, Filed Jun. 30, 1993, now abandoned;

Nakajima, Satoshi, “Shell Extensions for an Operating System,” U.S. Pat.No. 5,831,606, Issued Nov. 3, 1998 and Filed Dec. 13, 1994;

Nixon, Toby L., “Method and System for Determining Control of aTelephone Communication Among Multiple Application Programs,” Ser. No.08/318989, Filed Oct. 6, 1994, now abandoned;

Oran, Daniel P., “Operating System Provided Notification Area forDisplaying Visual Notifications from Application Programs,” U.S. Pat.No. 5,617,526, Issued Apr. 1, 1997 and Filed Dec. 13, 1994;

Parry, William G., “Improved Method and Apparatus for Controlling PowerDown of a Hard Disk Drive in a Computer,” U.S. Pat. No. 5,574,920,Issued Nov. 12, 1996 and Filed Oct. 25, 1994;

Patrick, Stuart R., “Method and Apparatus for Creating and PerformingGraphics Operations on Device-Independent Bitmaps,” U.S. Pat. No.5,734,387, Issued Mar. 31, 1998 and Filed Oct. 24, 1994;

Patrick, Stuart R., “Run-time Code Compiler for Data Block Transfer,”U.S. Pat. No. 5,706,483, Issued Jan. 6, 1998 and Filed Dec. 13, 1994;

Patrick, Stuart R., “Method and Apparatus for Creating and Transferringa,” U.S. Pat. No. 5,659,336, Issued Aug. 19, 1997 and Filed Oct. 24,1994;

Patrick, Stuart R., “Bitmap Block Transfer Image Conversion,” U.S. Pat.No. 5,644,758, Issued Jul. 1, 1997 and Filed Dec. 13, 1994;

Radko, Ron, “Providing Applications Programs with Unmediated Access to aContested Hardware Resource,” U.S. Pat. No. 5,901,312, Issued May 4,1999 and Filed Dec. 13, 1994;

Richman, Darryl, “Method for Automatically Configuring Devices includinga Network Adapter without Manual Intervention and without PriorConfiguration Information,” U.S. Pat. No. 5,655,148, Issued Aug. 5, 1997and Filed Dec. 13, 1994;

Sadovsky, “Method for Providing Access to Independent Network Resourcesby Establishing Connection Using an Application Programming InterfaceFunction Call Without Prompting the User for Authentication Data,” U.S.Pat. No. 5,689,638, Issued Nov. 18, 1997 and Filed Dec. 13, 1994;

Smale, Leonard T., “Notification Mechanism for Coordinating SoftwareExtensions,” Ser. No. 08/354,630, Filed Dec. 13, 1994, now abandoned;

Veghte, William L., “Method and System for Connecting to Browsing andAccessing Computer Network Resources,” U.S. Pat. No. 5,953,012, IssuedSep. 14, 1999 and Filed Dec. 13, 1994;

Williams, Robert J., “Device Independent Modem Interface,” U.S. Pat. No.5,815,682, Issued Sep. 29, 1998 and Filed Dec. 13, 1994;

Williams, Robert J., “Method and Apparatus for Maintaining NetworkCommunications on a Computer Capable of Connecting to a WAN and a LAN,”U.S. Pat. No. 5,659,685, Issued Aug. 19, 1997 and Filed Dec. 13, 1994;

Forming a part of the present specification is SDK/DDK documentationmade available by Microsoft to third party developers to enable them toutilize the disclosed API technologies (as published by Microsoft onOct. 28, 1994). Due to its length, such documentation is not printed aspart of the patent application but is made of record in the applicationfile of the parent application in CD-ROM form. This documentationincludes the following files:

-   -   WIN95SDKCCTL32_(—)1.DOC    -   WIN95SDKCCTL32_(—)2.DOC    -   WIN95SDKGDI    -   32 _(—)1.DOC    -   WIN95SDKGDI    -   32 _(—)2.DOC    -   WIN95SDKGUIDE_(—)1. DOC    -   WIN95SDKGUIDE_(—)2. DOC    -   WIN95SDKINTL32. DOC    -   WIN95SDKINTRO32. DOC    -   WIN95SDKJPEG.DOC    -   WIN95SDKKRNL32_(—)1.DOC    -   WIN95SDKKRNL32_(—)2.DOC    -   WIN95SDKKRNL32_(—)3.DOC    -   WIN95SDKMISC32. DOC    -   WIN95SDKMM32_(—)1.DOC    -   WIN95SDKMM32_(—)2.DOC    -   WIN95SDKMM32_(—)3.DOC    -   WIN95SDKMM32_(—)4.DOC    -   WIN95SDKOLERNOTE.DOC    -   WIN95SDKRNASPI.DOC    -   WIN95SDKSYSPOL.DOC    -   WIN95SDKUSER32_(—)1.DOC    -   WIN95SDKUSER32_(—)2.DOC    -   WIN95SDKUSER32_(—)3.DOC    -   WIN95SDKUSER32_(—)4.DOC    -   WIN95SDKWIN32UPD.DOC    -   WIN95DDKBLOCK.DOC    -   WIN95DDKCHICIFS.DOC    -   WIN95DDKDISPLAY.DOC    -   WIN95DDKEDITAPIF.DOC    -   WIN95DDKGRAPHICS.DOC    -   WIN95DDKIMEDLL.DOC    -   WIN95DDKKEYBOARD.DOC    -   WIN95DDKOUSE.DOC    -   WIN95DDKNETWORK2.DOC    -   WIN95DDKPENDRV.DOC    -   WIN95DDKPNP.DOC    -   WIN95DDKSTDVXD.DOC    -   WIN95DDKVCOMM.DOC    -   WIN95DDKVMM.DOC    -   WIN95DDKWNASPI32.DOC

1. A computer system including a microprocessor and a software program,the software program utilizing an application program interface torequest services from a windowed operating system, the requestedservices relating to display, manipulation or arrangement of items in awindow, which items may include text associated therewith, theapplication program interface including a separate means for requestingeach of the following services: arranging the items in an icon view;creating a drag image list for a specified item; removing all items fromthe window; removing a column of items from the window; removing an itemfrom the window; beginning in-place editing of text associated with aspecified item; ensuring that an item is entirely or at least partiallyvisible, scrolling a window control if necessary; searching for an itemwith specified characteristics; retrieving a background color of thewindow; retrieving a callback mask for the window; retrieving attributesof a window column; retrieving a width of a column in the window;calculating a number of items that can fit vertically in a visible areaof the window; retrieving a handle of an edit control being used to editan item's text; retrieving a handle of an image list used for drawingitems; retrieving some or all of an item's attributes; retrieving anumber of items in the window; retrieving a position of an item in thewindow; retrieving a bounding rectangle for all or part of an item in acurrent view of the window; retrieving a state of an item; retrievingtext associated with an item; searching for an item that has specifiedproperties and that bears a specified relationship to a given item;retrieving a current view origin for the window; determining a minimumcolumn width necessary to display all of a given string; retrieving atext background color of a window; retrieving a text color of a window;retrieving an index to a topmost visible item in the window; retrievinga bounding rectangle of all items in the window; determining which item,if any, is at a specified position; inserting a new column in a window;inserting a new item in a window; forcing a window to repaint a range ofitems; scrolling contents of a window; setting a background color of thewindow; setting a callback mask for a window; setting attributes of awindow column; changing a width of a window column; assigning an imagelist to a window; setting some or all of an item's attributes; preparinga window for adding items; moving an item to a specified position in thewindow; changing a state of an item in the window; changing textassociated with an item; setting a background color of text in thewindow; setting a text color of a window; sorting items using anapplication-defined comparison function; and updating an item.
 2. One ormore computer-readable media having computer-executable instructions forperforming a method of running a software program on a computer, thecomputer operating under an operating system that provides a windoweddisplay of graphical items, at least some of said items having textassociated therewith, the method including issuing instructions from thesoftware program requesting at least ten of the following functions fromthe operating system, each instruction corresponding to only one of saidfunctions: arranging the items in an icon view; creating a drag imagelist for a specified item; removing all items from the window; removinga column of items from the window; removing an item from the window;beginning in-place editing of text associated with a specified item;ensuring that an item is entirely or at least partially visible,scrolling a window control if necessary; searching for an item withspecified characteristics; retrieving a background color of the window;retrieving a callback mask for the window; retrieving attributes of awindow column; retrieving a width of a column in the window; calculatinga number of items that can fit vertically in a visible area of thewindow; retrieving a handle of an edit control being used to edit anitem's text; retrieving a handle of an image list used for drawingitems; retrieving some or all of an item's attributes; retrieving anumber of items in the window; retrieving a position of an item in thewindow; retrieving a bounding rectangle for all or part of an item in acurrent view of the window; retrieving a state of an item; retrievingtext associated with an item; searching for an item that has specifiedproperties and that bears a specified relationship to a given item;retrieving a current view origin for the window; determining a minimumcolumn width necessary to display all of a given string; retrieving atext background color of a window; retrieving a text color of a window;retrieving an index to a topmost visible item in the window; retrievinga bounding rectangle of all items in the window; determining which item,if any, is at a specified position; inserting a new column in a window;inserting a new item in a window; forcing a window to repaint a range ofitems; scrolling contents of a window; setting a background color of thewindow; setting a callback mask for a window; setting attributes of awindow column; changing a width of a window column; assigning an imagelist to a window; setting some or all of an item's attributes; preparinga window for adding items; moving an item to a specified position in thewindow; changing a state of an item in the window; changing textassociated with an item; setting a background color of text in thewindow; setting a text color of a window; sorting items using anapplication-defined comparison function; and updating an item.
 3. Theone or more computer-readable media of claim 2 in which saidinstructions all belong to a common class of instructions.
 4. One ormore computer-readable media having computer-executable instructions forperforming a method of invoking display of a collection of graphicalitems in an information handling system having a central processing unitand a display device, the central processing unit being controlled by anoperating system and having one or more software programs that performsoutput operation to the display device, said method being performed byan application program interface communicating between said softwareprogram and said operating system, the method comprising: issuing a callfrom the software program to the operating system requesting creation ofa list view window; receiving, by the software program, a handle to thewindow thereby created; storing said handle for future reference;sending a message to the window by use of said handle, the messagehaving the form: LVM_ARRANGE wParam=code; lParam=0; where code is aparameter selected from a group comprising: LVA_ALIGNBOTTOM,LVA_ALIGNLEFT, LVA_ALIGNRIGHT, LVA_ALIGNTOP, LVA_DEFAULT, andLVA_SNAPTOGRID.
 5. The one or more computer-readable media of claim 4,wherein the method further includes sending a plurality of furthermessages to said window by reference to said handle, said furthermessages being selected from the group comprising: LV_ITEM,LVM_DELETEALLITEMS, LVM_DELETEITEM, LVM_GETITEM, LVM_GETITEMCOUNT,LVM_GETITEMSTATE, LVM_GETITEMTEXT, LVM_INSERTITEM, LVM_SETITEM,LVM_SETITEMCOUNT, LVM_SETITEMSTATE, LVM_SETITEMTEXT, LV_DISPINFO,LVM_GETCALLBACKMASK, LVM_REDRAWITEMS, LVM_SETCALLBACKMASK, LVM_UPDATE,LVN_GETDISPINFO, LVN_SETDISPINFO, LV_COLUMN, LVM_DELETECOLUMN,LVM_GETCOLUMN, LVM_GETCOLUMNWIDTH, LVM_GETSTRINGWIDTH, LVM_INSERTCOLUMN,LVM_SETCOLUMN, LVM_SETCOLUMNWIDTH, LVN_COLUMNCLICK, LV_FINDINFO,LVM_FINDITEM, LVM_GETNEXTITEM, LVM_SORTITEMS, LV_HITTESTINFO,LVM_ENSUREVISIBLE, LVM_GETCOUNTPERPAGE, LVM_GETITEMPOSITION,LVM_GETITEMRECT, LVM_GETORIGIN, LVM_GETTOPINDEX, LVM_GETVIEWRECT,LVM_HITTEST, LVM_SCROLL, LVM_SETITEMPOSITION, LVM_GETBKCOLOR,LVM_GETTEXTBKCOLOR, LVM_GETTEXTCOLOR, LVM_SETBKCOLOR,LVM_SETTEXTBKCOLOR, LVM_SETTEXTCOLOR, LV_KEYDOWN, LVM_CREATEDRAGIMAGE,LVM_EDITLABEL, LVM_GETEDITCONTROL, LVM_GETIMAGELIST, LVM_SETIMAGELIST,LVN_BEGINDRAG, LVN_BEGINLABELEDIT, LVN_BEGINRDRAG, LVN_DELETEALLITEMS,LVN_DELETEITEM, LVN_ENDDRAG, LVN_ENDLABELEDIT, LVN_ENDRDRAG,LVN_INSERTITEM, LVN_ITEMCHANGED, LVN_ITEMCHANGING, and LVN_KEYDOWN. 6.One or more computer-readable media having computer-executableinstructions for performing a method for interfacing a plurality ofsoftware programs to an operating system, the method comprising:providing a set of application program interfaces, each responsive toprogram calls from said software programs; generating a call from one ofsaid application program interfaces to the operating system in responseto one of said program calls, said call requesting establishment of awindow of a ListView class; and passing one of a predefined set of“LVM-” messages from the software program to a list view control.
 7. Acomputer system comprising: means for including a set of program calls,each of said calls being related to a specific operating systemoperation, said set of program calls including a call requestingestablishment of a window of a ListView class; and means for exposing aset of application program interfaces, each corresponding to a programcall from said means for including the set of program calls, andincluding a message from the application program to a list view control,the message having an “LVN_” or “LVM_” prefix.
 8. A machine having amemory which contains a plurality of list view controls invoked by asoftware program, comprising: means for instructing an operating systemto load a common controls dynamic link library; means for calling anapplication program interface for creating a window of a ListView class;means for receiving and storing a window handle returned to the softwareprogram in response to said call; and means for issuing messages to theoperating system relating to manipulation of said window, said messagesreferring to said window handle.
 9. The machine of claim 8, furthercomprising means for requesting the operating system to perform onlyactions selected from the following list with respect to arrangement anddisplay of graphical items in the list view control window: arrangingthe items in an icon view; creating a drag image list for a specifieditem; removing all items from the window; removing a column of itemsfrom the window; removing an item from the window; beginning in-placeediting of a text associated with a specified item; ensuring that anitem is entirely or at least partially visible, scrolling a windowcontrol if necessary; searching for an item with specifiedcharacteristics; retrieving a background color of the window; retrievinga callback mask for the window; retrieving attributes of a windowcolumn; retrieving a width of a column in the window; calculating anumber of items that can fit vertically in a visible area of the window;retrieving a handle of an edit control being used to edit an item'stext; retrieving a handle of an image list used for drawing items;retrieving some or all of an item's attributes; retrieving a number ofitems in the window; retrieving a position of an item in the window;retrieving a bounding rectangle for all or part of an item in a currentview of the window; retrieving a state of an item; retrieving textassociated with an item; searching for an item that has specifiedproperties and that bears a specified relationship to a given item;retrieving a current view origin for the window; determining a minimumcolumn width necessary to display all of a given string; retrieving atext background color of a window; retrieving a text color of a window;retrieving an index to a topmost visible item in the window; retrievinga bounding rectangle of all items in the window; determining which item,if any, is at a specified position; inserting a new column in a window;inserting a new item in a window; forcing a window to repaint a range ofitems; scrolling contents of a window; setting a background color of thewindow; setting a callback mask for a window; setting attributes of awindow column; changing a width of a window column; assigning an imagelist to a window; setting some or all of an item's attributes; preparinga window for adding items; moving an item to a specified position in thewindow; changing a state of an item in the window; changing textassociated with an item; setting a background color of text in thewindow; setting a text color of a window; sorting items using anapplication-defined comparison function; and updating an item.
 10. Oneor more computer-readable media having computer-executable instructionsfor performing an invocation of a plurality of list view controls, theinvocation comprising: instructing an operating system to load a commoncontrols dynamic link library; calling an application program interfacefor creating a window of a ListView class; receiving and storing awindow handle returned to the software program in response to said call;and issuing messages to the operating system relating to manipulation ofsaid window, said messages referring to said window handle.
 11. The oneor more computer-readable media of claim 10 in which the messagesrequest the operating system to perform only actions selected from thefollowing list with respect to arrangement and display of graphicalitems in the list view control window: arranging the items in an iconview; creating a drag image list for a specified item; removing allitems from the window; removing a column of items from the window;removing an item from the window; beginning in-place editing of a textassociated with a specified item; ensuring that an item is entirely orat least partially visible, scrolling a window control if necessary;searching for an item with specified characteristics; retrieving abackground color of the window; retrieving a callback mask for thewindow; retrieving attributes of a window column; retrieving a width ofa column in the window; calculating a number of items that can fitvertically in a visible area of the window; retrieving a handle of anedit control being used to edit an item's text; retrieving a handle ofan image list used for drawing items; retrieving some or all of anitem's attributes; retrieving a number of items in the window;retrieving a position of an item in the window; retrieving a boundingrectangle for all or part of an item in a current view of the window;retrieving a state of an item; retrieving text associated with an item;searching for an item that has specified properties and that bears aspecified relationship to a given item; retrieving a current view originfor the window; determining a minimum column width necessary to displayall of a given string; retrieving a text background color of a window;retrieving a text color of a window; retrieving an index to a topmostvisible item in the window; retrieving a bounding rectangle of all itemsin the window; determining which item, if any, is at a specifiedposition; inserting a new column in a window; inserting a new item in awindow; forcing a window to repaint a range of items; scrolling contentsof a window; setting a background color of the window; setting acallback mask for a window; setting attributes of a window column;changing a width of a window column; assigning an image list to awindow; setting some or all of an item's attributes; preparing a windowfor adding items; moving an item to a specified position in the window;changing a state of an item in the window; changing text associated withan item; setting a background color of text in the window; setting atext color of a window; sorting items using an application-definedcomparison function; and updating an item.